gortiz commented on code in PR #19448:
URL: https://github.com/apache/pinot/pull/19448#discussion_r4666359173


##########
pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-spark-3/pom.xml:
##########
@@ -32,7 +32,14 @@
   <url>https://pinot.apache.org/</url>
   <properties>
     <pinot.root>${basedir}/../../..</pinot.root>
+    <!-- This jar runs inside a JVM Pinot does not control, so it relocates 
its libraries in every
+         build mode, including thin-plugins. See shade.jackson.prefix in the 
root pom. -->
+    
<shade.jackson.prefix>${shade.prefix}.com.fasterxml.jackson</shade.jackson.prefix>
+    <shade.guava.prefix>${shade.prefix}.com.google.common</shade.guava.prefix>
+    <shade.scala.prefix>${shade.prefix}.org.scala-lang</shade.scala.prefix>

Review Comment:
   The fail-fast and the docs are in (f348f6aeed, 88df65864f). 
`LaunchSparkDataIngestionJobCommand` refuses to run when the installation has a 
`plugin-libs/` directory, with a message that names the thin profile. As Xiang 
suggested, the thin assembly no longer ships the two `plugins-external` jars. A 
Hadoop job that cannot find its runner class now gets a message that mentions 
the thin profile too.
   



##########
pom.xml:
##########
@@ -3083,75 +3212,75 @@
           <relocations>
             <relocation>
               
<pattern>org.apache.hadoop.shaded.com.fasterxml.jackson.core</pattern>
-              
<shadedPattern>${shade.prefix}.com.fasterxml.jackson.core</shadedPattern>
+              <shadedPattern>${shade.jackson.prefix}.core</shadedPattern>
             </relocation>
             <relocation>
               
<pattern>org.apache.hadoop.shaded.com.fasterxml.jackson.databind</pattern>
-              
<shadedPattern>${shade.prefix}.com.fasterxml.jackson.databind</shadedPattern>
+              <shadedPattern>${shade.jackson.prefix}.databind</shadedPattern>
             </relocation>
             <relocation>
               
<pattern>org.apache.hadoop.shaded.com.fasterxml.jackson.annotation</pattern>
-              
<shadedPattern>${shade.prefix}.com.fasterxml.jackson.annotation</shadedPattern>
+              <shadedPattern>${shade.jackson.prefix}.annotation</shadedPattern>
             </relocation>
             <relocation>
               <pattern>com.facebook.presto.jdbc.internal.jackson</pattern>
-              
<shadedPattern>${shade.prefix}.com.fasterxml.jackson</shadedPattern>
+              <shadedPattern>${shade.jackson.prefix}</shadedPattern>
             </relocation>
             <relocation>
               <pattern>software.amazon.awssdk.thirdparty.jackson.core</pattern>
-              
<shadedPattern>${shade.prefix}.com.fasterxml.jackson.core</shadedPattern>
+              <shadedPattern>${shade.jackson.prefix}.core</shadedPattern>

Review Comment:
   Thanks, and thanks for the full scan, it was spot on. Fixed in 88df65864f: 
in the thin profile, `pinot-distribution` excludes `software.amazon.awssdk` 
from `pinot-tools`, so the whole SDK comes from `plugin-libs/`. I left the two 
declarations in `pinot-tools` alone so that the default build does not change.
   
   I also added a check that would have caught this: `ThinDistributionCheck` 
(2af2817301). For each class path that the launchers build, it resolves every 
method and field reference between two jars against the class that wins on that 
class path. On c8fb011 it reports exactly these two references, and on the new 
head it reports none. It runs in a new thin-plugins job of the quickstart 
workflow.
   



##########
pinot-distribution/pinot-assembly-thin.xml:
##########
@@ -0,0 +1,537 @@
+<!--
+
+    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.
+
+-->
+<assembly
+    
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
+  <id>bin</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>true</includeBaseDirectory>
+
+  <files>
+    <!-- Rename LICENSE-binary, NOTICE-binary to LICENSE, NOTICE and include 
them to a distribution tarbell -->
+    <file>
+      <source>${pinot.root}/LICENSE-binary</source>
+      <destName>LICENSE</destName>
+    </file>
+    <file>
+      <source>${pinot.root}/NOTICE-binary</source>
+      <destName>NOTICE</destName>
+    </file>
+    <!-- Include Pinot All-in-one jar -->
+    <file>
+      
<source>${pinot.root}/pinot-distribution/target/pinot-distribution-${project.version}-shaded.jar</source>
+      
<destName>lib/pinot-all-${project.version}-jar-with-dependencies.jar</destName>
+    </file>
+    <!-- Start Include Pinot Plugins-->
+    <!-- Start Include Pinot Stream Ingestion Plugins-->
+    <!-- End Include Pinot Stream Ingestion Plugins-->
+    <!-- Start Include Pinot Batch Ingestion Plugins-->
+    <file>
+      <source>
+        
${pinot.root}/pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-hadoop/target/pinot-batch-ingestion-hadoop-${project.version}-shaded.jar
+      </source>
+      <destName>
+        
plugins-external/pinot-batch-ingestion/pinot-batch-ingestion-hadoop/pinot-batch-ingestion-hadoop-${project.version}-shaded.jar
+      </destName>
+    </file>
+    <file>
+      <source>
+        
${pinot.root}/pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-spark-3/target/pinot-batch-ingestion-spark-3-${project.version}-shaded.jar
+      </source>
+      <destName>
+        
plugins-external/pinot-batch-ingestion/pinot-batch-ingestion-spark-3/pinot-batch-ingestion-spark-3-${project.version}-shaded.jar
+      </destName>
+    </file>
+    <!-- End Include Pinot Batch Ingestion Plugins-->
+    <!-- Start Include Pinot File System Plugins-->
+    <!-- End Include Pinot File System Plugins-->
+    <!-- Start Include Pinot Environment Plugins-->
+    <!-- End Include Pinot Environment Plugins-->
+    <!-- Start Include Pinot Input Format Plugins-->
+    <!-- End Include Pinot Input Format Plugins-->
+    <!-- Start Include Pinot Minion Tasks Plugins-->
+    <!-- End Include Pinot Minion Tasks Plugins-->
+    <!-- Start Include Pinot Metrics Plugins-->
+    <!-- End Include Pinot Metrics Plugins-->
+    <!-- Start Include Pinot Segment Writer Plugins-->
+    <!-- End Include Pinot Segment Writer Plugins-->
+    <!-- Start Include Pinot Segment Uploader Plugins-->
+    <!-- End Include Pinot Segment Uploader Plugins-->
+    <!-- Start Include Pinot Time Series Plugins -->
+    <!-- End Include Pinot Time Series Plugins -->
+    <!-- End Include Pinot Plugins-->
+  </files>
+  <fileSets>
+    <!--
+      Thin plugin layout, used by the thin-plugins profile; pinot-assembly.xml 
is the default
+      layout and both must ship the same plugins. Each plugin ships its own 
jar plus
+      pinot-plugin.classpath, the list of shared-store jars it needs. 
PluginManager still names a
+      plugin after the directory its jar sits in. Every plugin's dependencies 
are merged into one
+      plugin-libs/ store, so a library several plugins use is shipped once.
+    -->
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-stream-ingestion/pinot-kafka-4.0/target</directory>
+      
<outputDirectory>plugins/pinot-stream-ingestion/pinot-kafka-4.0</outputDirectory>
+      <includes>
+        <include>pinot-kafka-4.0-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>

Review Comment:
   Fixed in f348f6aeed. The legacy loader now adds the jars that 
`pinot-plugin.classpath` names, resolved against the nearest parent directory 
that contains them, so it works with an absolute or a relative `plugins.dir`. I 
checked it with a JVM that has only `pinot-all` on the class path and 
`-Dplugins.dir`: one class from every indexed jar of every plugin loads through 
the plugin class loader. The realm path (`pinot-plugin.properties`) does not 
read the index yet. I think that belongs with #18459.
   



##########
pinot-distribution/pinot-assembly-thin.xml:
##########
@@ -0,0 +1,537 @@
+<!--
+
+    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.
+
+-->
+<assembly
+    
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
+  <id>bin</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>true</includeBaseDirectory>
+
+  <files>
+    <!-- Rename LICENSE-binary, NOTICE-binary to LICENSE, NOTICE and include 
them to a distribution tarbell -->
+    <file>
+      <source>${pinot.root}/LICENSE-binary</source>
+      <destName>LICENSE</destName>
+    </file>
+    <file>
+      <source>${pinot.root}/NOTICE-binary</source>
+      <destName>NOTICE</destName>
+    </file>
+    <!-- Include Pinot All-in-one jar -->
+    <file>
+      
<source>${pinot.root}/pinot-distribution/target/pinot-distribution-${project.version}-shaded.jar</source>
+      
<destName>lib/pinot-all-${project.version}-jar-with-dependencies.jar</destName>
+    </file>
+    <!-- Start Include Pinot Plugins-->
+    <!-- Start Include Pinot Stream Ingestion Plugins-->
+    <!-- End Include Pinot Stream Ingestion Plugins-->
+    <!-- Start Include Pinot Batch Ingestion Plugins-->
+    <file>
+      <source>
+        
${pinot.root}/pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-hadoop/target/pinot-batch-ingestion-hadoop-${project.version}-shaded.jar
+      </source>
+      <destName>
+        
plugins-external/pinot-batch-ingestion/pinot-batch-ingestion-hadoop/pinot-batch-ingestion-hadoop-${project.version}-shaded.jar
+      </destName>
+    </file>
+    <file>
+      <source>
+        
${pinot.root}/pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-spark-3/target/pinot-batch-ingestion-spark-3-${project.version}-shaded.jar
+      </source>
+      <destName>
+        
plugins-external/pinot-batch-ingestion/pinot-batch-ingestion-spark-3/pinot-batch-ingestion-spark-3-${project.version}-shaded.jar
+      </destName>
+    </file>
+    <!-- End Include Pinot Batch Ingestion Plugins-->
+    <!-- Start Include Pinot File System Plugins-->
+    <!-- End Include Pinot File System Plugins-->
+    <!-- Start Include Pinot Environment Plugins-->
+    <!-- End Include Pinot Environment Plugins-->
+    <!-- Start Include Pinot Input Format Plugins-->
+    <!-- End Include Pinot Input Format Plugins-->
+    <!-- Start Include Pinot Minion Tasks Plugins-->
+    <!-- End Include Pinot Minion Tasks Plugins-->
+    <!-- Start Include Pinot Metrics Plugins-->
+    <!-- End Include Pinot Metrics Plugins-->
+    <!-- Start Include Pinot Segment Writer Plugins-->
+    <!-- End Include Pinot Segment Writer Plugins-->
+    <!-- Start Include Pinot Segment Uploader Plugins-->
+    <!-- End Include Pinot Segment Uploader Plugins-->
+    <!-- Start Include Pinot Time Series Plugins -->
+    <!-- End Include Pinot Time Series Plugins -->
+    <!-- End Include Pinot Plugins-->
+  </files>
+  <fileSets>
+    <!--
+      Thin plugin layout, used by the thin-plugins profile; pinot-assembly.xml 
is the default
+      layout and both must ship the same plugins. Each plugin ships its own 
jar plus
+      pinot-plugin.classpath, the list of shared-store jars it needs. 
PluginManager still names a
+      plugin after the directory its jar sits in. Every plugin's dependencies 
are merged into one
+      plugin-libs/ store, so a library several plugins use is shipped once.
+    -->
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-stream-ingestion/pinot-kafka-4.0/target</directory>
+      
<outputDirectory>plugins/pinot-stream-ingestion/pinot-kafka-4.0</outputDirectory>
+      <includes>
+        <include>pinot-kafka-4.0-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-stream-ingestion/pinot-kinesis/target</directory>
+      
<outputDirectory>plugins/pinot-stream-ingestion/pinot-kinesis</outputDirectory>
+      <includes>
+        <include>pinot-kinesis-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-stream-ingestion/pinot-pulsar/target</directory>
+      
<outputDirectory>plugins/pinot-stream-ingestion/pinot-pulsar</outputDirectory>
+      <includes>
+        <include>pinot-pulsar-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-standalone/target</directory>
+      
<outputDirectory>plugins/pinot-batch-ingestion/pinot-batch-ingestion-standalone</outputDirectory>
+      <includes>
+        
<include>pinot-batch-ingestion-standalone-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-file-system/pinot-adls/target</directory>
+      <outputDirectory>plugins/pinot-file-system/pinot-adls</outputDirectory>
+      <includes>
+        <include>pinot-adls-${project.version}.jar</include>
+        <include>pinot-plugin.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      
<directory>${pinot.root}/pinot-plugins/pinot-file-system/pinot-gcs/target</directory>
+      <outputDirectory>plugins/pinot-file-system/pinot-gcs</outputDirectory>
+      <includes>
+        <include>pinot-gcs-${project.version}.jar</include>

Review Comment:
   Fixed in 88df65864f. The plugin jars and indexes are `<file>` entries now, 
so a missing one fails the assembly. Since that turns the missing reactor edge 
into a hard failure, I also gave `pinot-distribution` a build-order dependency 
(`provided`, no transitive dependencies) on the 11 plugins that do not come 
through `pinot-tools`. I tested it by deleting the `pinot-gcs` jar and index 
and running `-pl pinot-distribution -am`: the build fails now.
   



##########
pinot-plugins/pom.xml:
##########
@@ -110,6 +125,60 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <!--
+        Thin plugin layout; see the thin-plugins profile in the root pom. A 
plugin no longer bundles
+        its dependencies, so this collects them into target/plugin-libs, from 
where the
+        distribution assembly merges every plugin's into one shared 
plugin-libs/ store. It also
+        writes pinot-plugin.classpath, the list of store jars this plugin 
needs, one
+        distribution-relative path per line. The store cannot say which plugin 
needs which jar,
+        and the launcher (PLUGINS_INCLUDE) and 
LaunchSparkDataIngestionJobCommand
+        (-pluginsToLoad / -pluginsToExclude) both have to know.
+      -->
+      <id>thin-plugins</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>collect-plugin-libs</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>copy-dependencies</goal>
+                </goals>
+                <configuration>
+                  <skip>${plugin.libs.skip}</skip>
+                  
<outputDirectory>${project.build.directory}/plugin-libs</outputDirectory>

Review Comment:
   Fixed in 88df65864f. A `maven-clean-plugin` execution empties 
`target/plugin-libs` at `prepare-package`, before `copy-dependencies` runs. I 
tested it by leaving an extra jar in `pinot-gcs/target/plugin-libs` and 
rebuilding without `clean`, and it no longer reaches the distribution. 
`ThinDistributionCheck` also fails on a store jar that no index names, and on 
two versions of one artifact. That second rule found `threeten-extra` 1.7.1 and 
1.8.0 side by side (orc and gcs), so the profile now manages `threeten-extra`.
   



##########
pinot-tools/src/main/resources/appAssemblerScriptTemplate:
##########
@@ -155,6 +175,10 @@ if [ -z "$PLUGINS_CLASSPATH" ] ; then
             PLUGINS_CLASSPATH=$PLUGIN_JAR
           fi
         done
+        # No selection was made, so every plugin is loaded and the whole 
shared store is needed.
+        if [ -d "$BASEDIR"/plugin-libs ] ; then
+          
PLUGINS_CLASSPATH=${PLUGINS_CLASSPATH:+$PLUGINS_CLASSPATH:}"$BASEDIR"/plugin-libs/*

Review Comment:
   Fixed in f348f6aeed. The launcher adds the whole store only when the 
built-in plugins directory is in `PLUGINS_DIR`, and only after the jars of 
every directory, so a jar in a custom root wins again. For a custom root it 
adds the store jars that the indexes of its plugins name. One consequence: a 
`PLUGINS_DIR` with only custom roots no longer gets the whole store, only what 
those plugins need. I noted that in the description.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to