Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding gradle publish task to ppl & protocol module to create slim jars #2445

Closed
wants to merge 3 commits into from

Conversation

zane-neo
Copy link
Contributor

Description

Adding gradle publish task to ppl & protocol module to create slim jars

Issues Resolved

Adding gradle publish task to ppl & protocol module to create slim jars

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4af150e) 95.41% compared to head (03a6f59) 95.41%.

Additional details and impacted files
@@            Coverage Diff            @@
##                2.x    #2445   +/-   ##
=========================================
  Coverage     95.41%   95.41%           
  Complexity     5022     5022           
=========================================
  Files           479      479           
  Lines         14072    14072           
  Branches        933      933           
=========================================
  Hits          13427    13427           
  Misses          625      625           
  Partials         20       20           
Flag Coverage Δ
sql-engine 95.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +97 to +98
groupId = 'org.opensearch'
artifactId = 'opensearch-protocol'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole SQL plugin artifact is published here: https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-sql-plugin
So we want to publish its slim jar to a different group and artifact ID?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't change the plugin's location in maven repo, this only controls the slim jar's location and it seems opensearch jars are always under org.opensearch folder: https://mvnrepository.com/search?q=org.opensearch&p=1

Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PPL transport model class is in plugin module. So how we add this dependency? Just thinking if we have to depend on the current SQL artifact https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-sql-plugin anyway, probably we don't need this slim jar?

@zane-neo
Copy link
Contributor Author

zane-neo commented Dec 6, 2023

PPL transport model class is in plugin module. So how we add this dependency? Just thinking if we have to depend on the current SQL artifact https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-sql-plugin anyway, probably we don't need this slim jar?

We still need these slim jars since when building ml-common plugin(which is a shadow jar), it'll recursively find all dependent jars to its classpath, without these jars, it's not possible to build a ml-common plugin successfully. Also, in runtime, different plugins are loaded by different classloaders, so ml-commons can not see the classes under sql plugin, without these jars under ml-commons plugin, there'll be runtime errors.

@dai-chen
Copy link
Collaborator

dai-chen commented Dec 6, 2023

PPL transport model class is in plugin module. So how we add this dependency? Just thinking if we have to depend on the current SQL artifact https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-sql-plugin anyway, probably we don't need this slim jar?

We still need these slim jars since when building ml-common plugin(which is a shadow jar), it'll recursively find all dependent jars to its classpath, without these jars, it's not possible to build a ml-common plugin successfully. Also, in runtime, different plugins are loaded by different classloaders, so ml-commons can not see the classes under sql plugin, without these jars under ml-commons plugin, there'll be runtime errors.

I downloaded the current SQL zip artifact published to Maven to double check. It actually contains all jar files, including plugin, PPL and protocol module jar. I was thinking any chance your gradle depends on it directly and remove those you feel not needed at runtime? Let me know if I missed anything.

opensearch-sql-plugin-2.11.1.0 ll
total 105888
-rw-r--r--@ 1 daichen  staff    11K Feb  1  1980 LICENSE.txt
-rw-r--r--@ 1 daichen  staff   721B Feb  1  1980 NOTICE.txt
-rw-r--r--@ 1 daichen  staff   234K Feb  1  1980 ST4-4.0.8.jar
-rw-r--r--@ 1 daichen  staff    17K Feb  1  1980 annotations-13.0.jar
-rw-r--r--@ 1 daichen  staff   164K Feb  1  1980 antlr-runtime-3.5.2.jar
-rw-r--r--@ 1 daichen  staff   1.3M Feb  1  1980 antlr4-4.7.1.jar
-rw-r--r--@ 1 daichen  staff   329K Feb  1  1980 antlr4-runtime-4.7.1.jar
-rw-r--r--@ 1 daichen  staff   231K Feb  1  1980 aws-encryption-sdk-java-2.4.1.jar
-rw-r--r--@ 1 daichen  staff   1.0M Feb  1  1980 aws-java-sdk-core-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   1.2M Feb  1  1980 aws-java-sdk-emr-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   312K Feb  1  1980 aws-java-sdk-emrserverless-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   151K Feb  1  1980 aws-java-sdk-sts-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   8.0M Feb  1  1980 bcprov-ext-jdk18on-1.75.jar
-rw-r--r--@ 1 daichen  staff   219K Feb  1  1980 checker-qual-3.33.0.jar
-rw-r--r--@ 1 daichen  staff    46K Feb  1  1980 common-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   700K Feb  1  1980 common-utils-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   241K Feb  1  1980 commons-beanutils-1.9.4.jar
-rw-r--r--@ 1 daichen  staff   336K Feb  1  1980 commons-codec-1.13.jar
-rw-r--r--@ 1 daichen  staff   575K Feb  1  1980 commons-collections-3.2.2.jar
-rw-r--r--@ 1 daichen  staff   192K Feb  1  1980 commons-digester-2.1.jar
-rw-r--r--@ 1 daichen  staff   279K Feb  1  1980 commons-io-2.8.0.jar
-rw-r--r--@ 1 daichen  staff   574K Feb  1  1980 commons-lang3-3.12.0.jar
-rw-r--r--@ 1 daichen  staff    60K Feb  1  1980 commons-logging-1.2.jar
-rw-r--r--@ 1 daichen  staff   2.1M Feb  1  1980 commons-math3-3.6.1.jar
-rw-r--r--@ 1 daichen  staff   185K Feb  1  1980 commons-validator-1.7.jar
-rw-r--r--@ 1 daichen  staff   659K Feb  1  1980 core-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    60K Feb  1  1980 datasources-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   1.9M Feb  1  1980 druid-1.0.15.jar
-rw-r--r--@ 1 daichen  staff    16K Feb  1  1980 error_prone_annotations-2.18.0.jar
-rw-r--r--@ 1 daichen  staff   4.5K Feb  1  1980 failureaccess-1.0.1.jar
-rw-r--r--@ 1 daichen  staff    93K Feb  1  1980 geo-2.11.1.jar
-rw-r--r--@ 1 daichen  staff   252K Feb  1  1980 gson-2.8.9.jar
-rw-r--r--@ 1 daichen  staff   2.9M Feb  1  1980 guava-32.0.1-jre.jar
-rw-r--r--@ 1 daichen  staff   177K Feb  1  1980 httpasyncclient-4.1.5.jar
-rw-r--r--@ 1 daichen  staff   767K Feb  1  1980 httpclient-4.5.14.jar
-rw-r--r--@ 1 daichen  staff   321K Feb  1  1980 httpcore-4.4.15.jar
-rw-r--r--@ 1 daichen  staff   360K Feb  1  1980 httpcore-nio-4.4.16.jar
-rw-r--r--@ 1 daichen  staff    11M Feb  1  1980 icu4j-58.2.jar
-rw-r--r--@ 1 daichen  staff   552K Feb  1  1980 ion-java-1.0.2.jar
-rw-r--r--@ 1 daichen  staff   869K Feb  1  1980 ipaddress-5.4.0.jar
-rw-r--r--@ 1 daichen  staff   9.1K Feb  1  1980 j2objc-annotations-2.8.jar
-rw-r--r--@ 1 daichen  staff    74K Feb  1  1980 jackson-annotations-2.15.2.jar
-rw-r--r--@ 1 daichen  staff   1.5M Feb  1  1980 jackson-databind-2.15.2.jar
-rw-r--r--@ 1 daichen  staff   764K Feb  1  1980 javassist-3.26.0-GA.jar
-rw-r--r--@ 1 daichen  staff    83K Feb  1  1980 javax.json-1.0.4.jar
-rw-r--r--@ 1 daichen  staff    27K Feb  1  1980 jmespath-java-1.12.545.jar
-rw-r--r--@ 1 daichen  staff    71K Feb  1  1980 json-20230227.jar
-rw-r--r--@ 1 daichen  staff    19K Feb  1  1980 jsr305-3.0.2.jar
-rw-r--r--@ 1 daichen  staff   2.8M Feb  1  1980 kotlin-reflect-1.4.30.jar
-rw-r--r--@ 1 daichen  staff   1.6M Feb  1  1980 kotlin-stdlib-1.9.0.jar
-rw-r--r--@ 1 daichen  staff   196K Feb  1  1980 kotlin-stdlib-common-1.6.0.jar
-rw-r--r--@ 1 daichen  staff   958B Feb  1  1980 kotlin-stdlib-jdk7-1.9.0.jar
-rw-r--r--@ 1 daichen  staff   968B Feb  1  1980 kotlin-stdlib-jdk8-1.8.0.jar
-rw-r--r--@ 1 daichen  staff   951K Feb  1  1980 legacy-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   2.1K Feb  1  1980 listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
-rw-r--r--@ 1 daichen  staff   764K Feb  1  1980 okhttp-4.10.0.jar
-rw-r--r--@ 1 daichen  staff    14K Feb  1  1980 okhttp-aws-signer-1.0.2.jar
-rw-r--r--@ 1 daichen  staff   352K Feb  1  1980 okio-jvm-3.4.0.jar
-rw-r--r--@ 1 daichen  staff   248K Feb  1  1980 opensearch-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   499K Feb  1  1980 opensearch-ml-client-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    67K Feb  1  1980 opensearch-rest-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    37K Feb  1  1980 opensearch-sql-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    66K Feb  1  1980 opensearch-ssl-config-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    26K Feb  1  1980 org.abego.treelayout.core-1.0.3.jar
-rw-r--r--@ 1 daichen  staff    85K Feb  1  1980 parent-join-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff   1.8K Feb  1  1980 plugin-descriptor.properties
-rw-r--r--@ 1 daichen  staff   1.0K Feb  1  1980 plugin-security.policy
-rw-r--r--@ 1 daichen  staff   334K Feb  1  1980 ppl-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    24K Feb  1  1980 presto-matching-0.240.jar
-rw-r--r--@ 1 daichen  staff    87K Feb  1  1980 prometheus-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    38K Feb  1  1980 protocol-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   103K Feb  1  1980 reflections-0.9.12.jar
-rw-r--r--@ 1 daichen  staff   117K Feb  1  1980 reindex-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    52K Feb  1  1980 resilience4j-core-1.5.0.jar
-rw-r--r--@ 1 daichen  staff    45K Feb  1  1980 resilience4j-retry-1.5.0.jar
-rw-r--r--@ 1 daichen  staff    40K Feb  1  1980 slf4j-api-1.7.36.jar
-rw-r--r--@ 1 daichen  staff   944K Feb  1  1980 spark-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   360K Feb  1  1980 sql-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   877K Feb  1  1980 vavr-0.10.2.jar
-rw-r--r--@ 1 daichen  staff   3.0K Feb  1  1980 vavr-match-0.10.2.jar

@zane-neo
Copy link
Contributor Author

zane-neo commented Dec 7, 2023

PPL transport model class is in plugin module. So how we add this dependency? Just thinking if we have to depend on the current SQL artifact https://mvnrepository.com/artifact/org.opensearch.plugin/opensearch-sql-plugin anyway, probably we don't need this slim jar?

We still need these slim jars since when building ml-common plugin(which is a shadow jar), it'll recursively find all dependent jars to its classpath, without these jars, it's not possible to build a ml-common plugin successfully. Also, in runtime, different plugins are loaded by different classloaders, so ml-commons can not see the classes under sql plugin, without these jars under ml-commons plugin, there'll be runtime errors.

I downloaded the current SQL zip artifact published to Maven to double check. It actually contains all jar files, including plugin, PPL and protocol module jar. I was thinking any chance your gradle depends on it directly and remove those you feel not needed at runtime? Let me know if I missed anything.

opensearch-sql-plugin-2.11.1.0 ll
total 105888
-rw-r--r--@ 1 daichen  staff    11K Feb  1  1980 LICENSE.txt
-rw-r--r--@ 1 daichen  staff   721B Feb  1  1980 NOTICE.txt
-rw-r--r--@ 1 daichen  staff   234K Feb  1  1980 ST4-4.0.8.jar
-rw-r--r--@ 1 daichen  staff    17K Feb  1  1980 annotations-13.0.jar
-rw-r--r--@ 1 daichen  staff   164K Feb  1  1980 antlr-runtime-3.5.2.jar
-rw-r--r--@ 1 daichen  staff   1.3M Feb  1  1980 antlr4-4.7.1.jar
-rw-r--r--@ 1 daichen  staff   329K Feb  1  1980 antlr4-runtime-4.7.1.jar
-rw-r--r--@ 1 daichen  staff   231K Feb  1  1980 aws-encryption-sdk-java-2.4.1.jar
-rw-r--r--@ 1 daichen  staff   1.0M Feb  1  1980 aws-java-sdk-core-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   1.2M Feb  1  1980 aws-java-sdk-emr-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   312K Feb  1  1980 aws-java-sdk-emrserverless-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   151K Feb  1  1980 aws-java-sdk-sts-1.12.545.jar
-rw-r--r--@ 1 daichen  staff   8.0M Feb  1  1980 bcprov-ext-jdk18on-1.75.jar
-rw-r--r--@ 1 daichen  staff   219K Feb  1  1980 checker-qual-3.33.0.jar
-rw-r--r--@ 1 daichen  staff    46K Feb  1  1980 common-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   700K Feb  1  1980 common-utils-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   241K Feb  1  1980 commons-beanutils-1.9.4.jar
-rw-r--r--@ 1 daichen  staff   336K Feb  1  1980 commons-codec-1.13.jar
-rw-r--r--@ 1 daichen  staff   575K Feb  1  1980 commons-collections-3.2.2.jar
-rw-r--r--@ 1 daichen  staff   192K Feb  1  1980 commons-digester-2.1.jar
-rw-r--r--@ 1 daichen  staff   279K Feb  1  1980 commons-io-2.8.0.jar
-rw-r--r--@ 1 daichen  staff   574K Feb  1  1980 commons-lang3-3.12.0.jar
-rw-r--r--@ 1 daichen  staff    60K Feb  1  1980 commons-logging-1.2.jar
-rw-r--r--@ 1 daichen  staff   2.1M Feb  1  1980 commons-math3-3.6.1.jar
-rw-r--r--@ 1 daichen  staff   185K Feb  1  1980 commons-validator-1.7.jar
-rw-r--r--@ 1 daichen  staff   659K Feb  1  1980 core-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    60K Feb  1  1980 datasources-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   1.9M Feb  1  1980 druid-1.0.15.jar
-rw-r--r--@ 1 daichen  staff    16K Feb  1  1980 error_prone_annotations-2.18.0.jar
-rw-r--r--@ 1 daichen  staff   4.5K Feb  1  1980 failureaccess-1.0.1.jar
-rw-r--r--@ 1 daichen  staff    93K Feb  1  1980 geo-2.11.1.jar
-rw-r--r--@ 1 daichen  staff   252K Feb  1  1980 gson-2.8.9.jar
-rw-r--r--@ 1 daichen  staff   2.9M Feb  1  1980 guava-32.0.1-jre.jar
-rw-r--r--@ 1 daichen  staff   177K Feb  1  1980 httpasyncclient-4.1.5.jar
-rw-r--r--@ 1 daichen  staff   767K Feb  1  1980 httpclient-4.5.14.jar
-rw-r--r--@ 1 daichen  staff   321K Feb  1  1980 httpcore-4.4.15.jar
-rw-r--r--@ 1 daichen  staff   360K Feb  1  1980 httpcore-nio-4.4.16.jar
-rw-r--r--@ 1 daichen  staff    11M Feb  1  1980 icu4j-58.2.jar
-rw-r--r--@ 1 daichen  staff   552K Feb  1  1980 ion-java-1.0.2.jar
-rw-r--r--@ 1 daichen  staff   869K Feb  1  1980 ipaddress-5.4.0.jar
-rw-r--r--@ 1 daichen  staff   9.1K Feb  1  1980 j2objc-annotations-2.8.jar
-rw-r--r--@ 1 daichen  staff    74K Feb  1  1980 jackson-annotations-2.15.2.jar
-rw-r--r--@ 1 daichen  staff   1.5M Feb  1  1980 jackson-databind-2.15.2.jar
-rw-r--r--@ 1 daichen  staff   764K Feb  1  1980 javassist-3.26.0-GA.jar
-rw-r--r--@ 1 daichen  staff    83K Feb  1  1980 javax.json-1.0.4.jar
-rw-r--r--@ 1 daichen  staff    27K Feb  1  1980 jmespath-java-1.12.545.jar
-rw-r--r--@ 1 daichen  staff    71K Feb  1  1980 json-20230227.jar
-rw-r--r--@ 1 daichen  staff    19K Feb  1  1980 jsr305-3.0.2.jar
-rw-r--r--@ 1 daichen  staff   2.8M Feb  1  1980 kotlin-reflect-1.4.30.jar
-rw-r--r--@ 1 daichen  staff   1.6M Feb  1  1980 kotlin-stdlib-1.9.0.jar
-rw-r--r--@ 1 daichen  staff   196K Feb  1  1980 kotlin-stdlib-common-1.6.0.jar
-rw-r--r--@ 1 daichen  staff   958B Feb  1  1980 kotlin-stdlib-jdk7-1.9.0.jar
-rw-r--r--@ 1 daichen  staff   968B Feb  1  1980 kotlin-stdlib-jdk8-1.8.0.jar
-rw-r--r--@ 1 daichen  staff   951K Feb  1  1980 legacy-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   2.1K Feb  1  1980 listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
-rw-r--r--@ 1 daichen  staff   764K Feb  1  1980 okhttp-4.10.0.jar
-rw-r--r--@ 1 daichen  staff    14K Feb  1  1980 okhttp-aws-signer-1.0.2.jar
-rw-r--r--@ 1 daichen  staff   352K Feb  1  1980 okio-jvm-3.4.0.jar
-rw-r--r--@ 1 daichen  staff   248K Feb  1  1980 opensearch-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   499K Feb  1  1980 opensearch-ml-client-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    67K Feb  1  1980 opensearch-rest-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    37K Feb  1  1980 opensearch-sql-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    66K Feb  1  1980 opensearch-ssl-config-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    26K Feb  1  1980 org.abego.treelayout.core-1.0.3.jar
-rw-r--r--@ 1 daichen  staff    85K Feb  1  1980 parent-join-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff   1.8K Feb  1  1980 plugin-descriptor.properties
-rw-r--r--@ 1 daichen  staff   1.0K Feb  1  1980 plugin-security.policy
-rw-r--r--@ 1 daichen  staff   334K Feb  1  1980 ppl-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    24K Feb  1  1980 presto-matching-0.240.jar
-rw-r--r--@ 1 daichen  staff    87K Feb  1  1980 prometheus-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff    38K Feb  1  1980 protocol-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   103K Feb  1  1980 reflections-0.9.12.jar
-rw-r--r--@ 1 daichen  staff   117K Feb  1  1980 reindex-client-2.11.1.jar
-rw-r--r--@ 1 daichen  staff    52K Feb  1  1980 resilience4j-core-1.5.0.jar
-rw-r--r--@ 1 daichen  staff    45K Feb  1  1980 resilience4j-retry-1.5.0.jar
-rw-r--r--@ 1 daichen  staff    40K Feb  1  1980 slf4j-api-1.7.36.jar
-rw-r--r--@ 1 daichen  staff   944K Feb  1  1980 spark-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   360K Feb  1  1980 sql-2.11.1.0.jar
-rw-r--r--@ 1 daichen  staff   877K Feb  1  1980 vavr-0.10.2.jar
-rw-r--r--@ 1 daichen  staff   3.0K Feb  1  1980 vavr-match-0.10.2.jar

We do have another option which is to create a fat/shadow jar of plugin, we tried this option and have a POC PR here: Hailong-am@b7635ca. But this could have impact on publishing plugin zip. Publishing a slim jar is always better than shadow jar which can avoid a lot of jar conflict, so we prefer to publish slim jars like in this PR.

@zane-neo
Copy link
Contributor Author

zane-neo commented Dec 8, 2023

Using zip extraction approach to create a fat jar instead of publish slim jars.

@zane-neo zane-neo closed this Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants