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


##########
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:
   **[P1] Preserve the AWS SDK Jackson signature that Kinesis calls**
   
   `pinot-all` includes the SDK’s `json-utils` via S3. This rule rewrites 
`JsonNodeParser.Builder.jsonFactory` to take 
`com.fasterxml.jackson.core.JsonFactory`. Kinesis loads `aws-json-protocol` 
from `plugin-libs`, where the caller still expects 
`software.amazon.awssdk.thirdparty.jackson.core.JsonFactory`.
   
   I reproduced this with `listShards` and a mocked HTTP 400 for a missing 
stream. The unshaded SDK returned `ResourceNotFoundException`. With the thin 
core’s shaded `json-utils` first on the classpath, the error handler threw 
`NoSuchMethodError`. Please preserve a consistent AWS-private Jackson signature 
across core and plugin jars and cover this error response on the assembled 
classpath.



##########
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:
   **[P2] Let the Java plugin loader resolve the dependency index**
   
   An embedded JVM can load Kafka through `PluginManager` with `-Dplugins.dir`, 
without running the shell launcher. The existing loader collects jars below the 
plugin directory, so it never adds the `pinot-kafka-base` jar listed here. In a 
fixture using this layout, `StreamConsumerFactoryProvider.create` reached 
`KafkaConsumerFactory.init` and threw `NoClassDefFoundError` for 
`KafkaConfigBackwardCompatibleUtils`. The fat plugin initialized with the same 
configuration.
   
   Please have `PluginManager` resolve the indexed jars when constructing the 
plugin classloader and cover this path with the shared store absent from the 
JVM’s startup classpath.



##########
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:
   **[P2] Remove obsolete jars from the shared store on incremental builds**
   
   I packaged a dependency at `commons-lang3` 3.17.0, changed it to 3.18.0, and 
ran `package` again without `clean`. The index listed only 3.18.0, but the 
assembled tarball contained both versions. `copy-dependencies` leaves the old 
jar in this directory, the assembly copies `*.jar`, and the default launcher 
puts both versions on the classpath.
   
   Please refresh the staging directory before copying, or build the store from 
the current indexes, so a dependency upgrade also removes the superseded jar.



##########
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:
   **[P2] Fail assembly when an expected plugin or index is missing**
   
   Maven silently skips a `<fileSet>` when its directory or included files are 
absent. I exercised this descriptor with the mandatory core and external jars 
present and all plugin targets absent. Assembly succeeded and produced a 
tarball with no `plugins/` directory. GCS, for example, has no reactor 
dependency edge to `pinot-distribution` that guarantees its output is ready 
here.
   
   Please make the expected plugin jars and their indexes required inputs and 
ensure the producer modules finish before assembly. A missing GCS jar or index 
should fail the build.



##########
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>
+                  <!-- compile + runtime: `provided` dependencies such as 
pinot-spi are already in
+                       lib/pinot-all.jar -->
+                  <includeScope>runtime</includeScope>
+                  
<excludeGroupIds>${plugin.platform.groupIds}</excludeGroupIds>
+                  
<excludeArtifactIds>${plugin.platform.artifactIds}</excludeArtifactIds>
+                </configuration>
+              </execution>
+              <execution>
+                <id>plugin-classpath-index</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>build-classpath</goal>
+                </goals>
+                <configuration>
+                  <skip>${plugin.libs.skip}</skip>
+                  
<outputFile>${project.build.directory}/pinot-plugin.classpath</outputFile>
+                  <includeScope>runtime</includeScope>
+                  
<excludeGroupIds>${plugin.platform.groupIds}</excludeGroupIds>
+                  
<excludeArtifactIds>${plugin.platform.artifactIds}</excludeArtifactIds>
+                  <prefix>plugin-libs</prefix>
+                  <pathSeparator>&#10;</pathSeparator>

Review Comment:
   **[P3] Give the classpath index a platform-independent format**
   
   In a two-dependency Maven build with this configuration, the index used `:` 
between entries. Maven trims the whitespace-only `&#10;` value and 
`build-classpath` falls back to the host separator. A Windows JVM therefore 
writes `;` between entries and `\` inside paths. The launcher splits on colons 
and newlines, so it skips those dependencies when a plugin is selected.
   
   Please set an explicit `<pathSeparator>:</pathSeparator>` and 
`<fileSeparator>/</fileSeparator>`, or write one normalized path per line.



##########
pinot-tools/src/main/resources/appAssemblerScriptTemplate:
##########
@@ -134,16 +139,31 @@ if [ -z "$PLUGINS_CLASSPATH" ] ; then
             exit 1
         fi
         export IFS=';'
-        for PLUGIN_JAR in $PLUGINS_INCLUDE; do
-            case "$PLUGIN_JAR" in
-              pinot-kafka-2.0|pinot-kafka-3.0) PLUGIN_JAR=pinot-kafka-4.0 ;;
+        for PLUGIN_NAME in $PLUGINS_INCLUDE; do
+            unset IFS
+            case "$PLUGIN_NAME" in
+              pinot-kafka-2.0|pinot-kafka-3.0) PLUGIN_NAME=pinot-kafka-4.0 ;;
             esac
-            PLUGIN_JAR_PATH=$(find "$DIR" -path 
\*/"$PLUGIN_JAR"/"$PLUGIN_JAR"-\*.jar)
-            if [ -n "$PLUGINS_CLASSPATH" ] ; then
-              PLUGINS_CLASSPATH=$PLUGINS_CLASSPATH:$PLUGIN_JAR_PATH
-            else
-              PLUGINS_CLASSPATH=$PLUGIN_JAR_PATH
-            fi
+            for PLUGIN_JAR_PATH in $(find "$DIR" -path 
\*/"$PLUGIN_NAME"/\*.jar) ; do

Review Comment:
   **[P2] Preserve paths containing spaces when selecting a plugin**
   
   With `PLUGINS_INCLUDE=pinot-demo` and a jar under `plugins/input 
formats/pinot-demo/`, the base launcher produces one valid classpath entry. 
This loop splits it at the space into two nonexistent paths. The index lookup 
below splits the same directory name. The jar lookup also affects default fat 
distributions.
   
   Please iterate over NUL-delimited `find` results in both loops so each full 
path reaches the classpath builder.



##########
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:
   **[P2] Honor custom plugin roots when loading shared dependencies**
   
   `PLUGINS_DIR` can select plugins even when `PLUGINS_INCLUDE` is empty. With 
`PLUGINS_DIR=empty-root;custom-root`, the first directory adds the 
installation’s entire `plugin-libs/*` before the second directory’s jars. In a 
launcher test with two versions of the same class, Java loaded the stock 
version on this head and the custom version on the base.
   
   Please resolve dependencies from the indexes under the configured roots. The 
whole-store shortcut is safe only when loading the full built-in plugin set.



-- 
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