dsmiley commented on a change in pull request #324:
URL: https://github.com/apache/solr/pull/324#discussion_r730319810



##########
File path: solr/contrib/hdfs/.gitignore
##########
@@ -0,0 +1,2 @@
+# IDEA project file
+hdfs.iml

Review comment:
       Remove please; this is not specific to this module.

##########
File path: solr/contrib/README.md
##########
@@ -0,0 +1,31 @@
+Apache Solr HDFS Contrib module
+===============================
+
+Introduction
+------------
+This contrib module implements the support for Hadoop Distributed File System 
in Apache Solr. 
+
+
+Building
+--------
+The HDFS contrib module uses the same Gradle build as the core Solr 
components. 
+
+To build the module, you can use
+
+./gradlew :solr:contrib:hdfs:assemble
+
+The resulting module will be placed to the libs directory, for example:
+solr/contrib/hdfs/build/libs/solr-hdfs-9.0.0-SNAPSHOT.jar
+
+
+To execute the module tests:
+
+./gradlew :solr:contrib:hdfs:test
+
+
+
+Usage
+-----
+To use the module, it needs to be placed to the Solr web application classpath 
(for example by symlinking it to the WEB-INF/lib directory.)

Review comment:
       I suggest we don't recommend people putting libs into WEB-INF/lib unless 
it has to go there. <solr-home>/lib is the idea spot for libs that plug-in.

##########
File path: gradle/validation/rat-sources.gradle
##########
@@ -102,6 +102,12 @@ allprojects {
                     exclude "src/test-files/META-INF/services/*"
                     break
 
+                case ":solr:contrib:hdfs":

Review comment:
       Hopefully we can remove this part if we can remove the duplicated test 
stuff

##########
File path: solr/test-framework/build.gradle
##########
@@ -31,5 +31,16 @@ dependencies {
 
   implementation 'io.dropwizard.metrics:metrics-jetty9'
   implementation 'com.lmax:disruptor'
+
+  // used by the hadoop-specific test framework classes

Review comment:
       Please add a comment and URL to acknowledge this situation isn't good; 
it's a work-around.  Point to the JIRA comment where you explained why we have 
these dependencies.  This comment could also be placed on the abstract test 
base classes you moved to the test-framework module.  I could imagine someone 
looking at this and wonder what’s going on; the comment will help.  At some 
future time perhaps Gradle will fix the cross-test subclassing limitation and 
someone might fix this.

##########
File path: solr/core/src/java/org/apache/solr/update/UpdateHandler.java
##########
@@ -115,12 +115,9 @@ public UpdateHandler(SolrCore core, UpdateLog updateLog)  {
     boolean skipUpdateLog = core.getCoreDescriptor().getCloudDescriptor() != 
null && !core.getCoreDescriptor().getCloudDescriptor().requiresTransactionLog();
     if (updateLog == null && ulogPluginInfo != null && 
ulogPluginInfo.isEnabled() && !skipUpdateLog) {
       DirectoryFactory dirFactory = core.getDirectoryFactory();
-      if (dirFactory instanceof HdfsDirectoryFactory) {
-        ulog = new 
HdfsUpdateLog(((HdfsDirectoryFactory)dirFactory).getConfDir());
-      } else {
-        ulog = ulogPluginInfo.className == null ? new UpdateLog():
-                core.getResourceLoader().newInstance(ulogPluginInfo, 
UpdateLog.class, true);
-      }
+
+      ulog = ulogPluginInfo.className == null ? new UpdateLog():

Review comment:
       given that UpdateHandler no longer auto-picks the HdfsUpdateLog, do 
users need to do something different for it to be chosen?  (Should be 
documented if so)

##########
File path: solr/contrib/hdfs/build.gradle
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+apply plugin: 'java-library'
+
+description = 'HDFS Package'
+
+dependencies {
+  
+  implementation project(':solr:core')
+
+
+  //implementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-annotations') { transitive = false 
}
+  implementation ('org.apache.hadoop:hadoop-auth') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-common') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-hdfs-client') { transitive = false 
}
+  implementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }
+
+
+  
+  api('com.github.ben-manes.caffeine:caffeine', {
+    exclude group: "org.checkerframework", module: "checker-qual"
+  })
+
+  // Many HDFS tests are using/subclassing test framework classes
+  testImplementation project(':solr:test-framework')
+
+  // hadoop dependencies for tests
+  testImplementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }
+  testImplementation ('org.apache.hadoop:hadoop-common::tests') { transitive = 
false }
+  testImplementation ('org.apache.hadoop:hadoop-hdfs::tests') { transitive = 
false }
+  testImplementation ('org.apache.hadoop:hadoop-minikdc') { transitive = false 
}
+
+  testImplementation 'org.apache.logging.log4j:log4j-1.2-api'
+
+  // classes like solr.ICUCollationField, used by NNFailoverTest for example.
+  testImplementation project(':solr:contrib:analysis-extras')
+
+  // required for instantiating a Zookeeper server in tests or embedded
+  runtimeOnly ('org.xerial.snappy:snappy-java')

Review comment:
       I’m unclear what the embedded use-case is that keeps this on the runtime 
class path instead of only for tests.  I changed it to testRuntimeOnly and 
tests pass (to be expected I suppose).  Can you clarify?

##########
File path: solr/contrib/hdfs/build.gradle
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+apply plugin: 'java-library'
+
+description = 'HDFS Package'
+
+dependencies {
+  
+  implementation project(':solr:core')
+
+
+  //implementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-annotations') { transitive = false 
}
+  implementation ('org.apache.hadoop:hadoop-auth') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-common') { transitive = false }
+  implementation ('org.apache.hadoop:hadoop-hdfs-client') { transitive = false 
}
+  implementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }
+
+
+  
+  api('com.github.ben-manes.caffeine:caffeine', {
+    exclude group: "org.checkerframework", module: "checker-qual"
+  })
+
+  // Many HDFS tests are using/subclassing test framework classes
+  testImplementation project(':solr:test-framework')
+
+  // hadoop dependencies for tests
+  testImplementation ('org.apache.hadoop:hadoop-hdfs') { transitive = false }

Review comment:
       You are probably copy-pasting some of the dependency lines from 
solr-core.  Historically Solr has specified each dependency (even transitive) 
explicitly but Gradle allows us to use transitive dependencies while still 
allowing us to notice we're adding them via our versions.lock mechanism.  For 
example, perhaps Hadoop-common is a transitive of hadoop-hdfs (I dunno; just a 
hypothetical) and so you wouldn't need to even mention Hadoop-common).  The 
point isn't to reduce the # of lines here but to help with dependency 
maintenance as they evolve and change their dependencies.  For example maybe 
Hadoop 3.3.x adds some new dependency or removes a dependency.  If we use 
transitives then it's easier for us to maintain this and not keep what we don't 
actually need.  If you're not up for it; I could give it a shot.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to