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

Restore support for Java 8 for RestClient #11562

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

reta
Copy link
Collaborator

@reta reta commented Dec 11, 2023

Description

Restore support for Java 8 for RestClient. There are still community asks for 2.x clients compatible with Java 8 baseline. The issue has worsen recently due to breaking changes in 2.x baseline (#5902, #9082), runtime replacement 1.x vs 2.x is not transparent anymore (causes compile time issues).

Related Issues

Part of opensearch-project/opensearch-java#156

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

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
Contributor

❌ Gradle check result for b8f482e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 4c449c8: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Dec 11, 2023

Compatibility status:

Checks if related components are compatible with change 40b36ca

Incompatible components

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/sql.git]

Copy link
Contributor

❌ Gradle check result for 2170644: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Amazing! Is this enough to ensure that we don't break it in the future?

@dblock dblock added the backport 2.x Backport to 2.x branch label Dec 11, 2023
Copy link
Contributor

❕ Gradle check result for 40b36ca: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT.test {yaml=pit/10_basic/Delete all}

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@dblock dblock merged commit 4e72741 into opensearch-project:main Dec 11, 2023
31 checks passed
@dblock
Copy link
Member

dblock commented Dec 11, 2023

👏

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-11562-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4e727416c5fa231d5401bed9b3a4e28d912b0cb0
# Push it to GitHub
git push --set-upstream origin backport/backport-11562-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-11562-to-2.x.

reta added a commit to reta/OpenSearch that referenced this pull request Dec 11, 2023
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit 4e72741)
deshsidd pushed a commit to deshsidd/OpenSearch that referenced this pull request Dec 11, 2023
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
reta added a commit that referenced this pull request Dec 12, 2023
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit 4e72741)
@praveenchandna
Copy link

Hello
Java 8 support is getting added in the OpenSearch "Java Client" or "Java high-level REST client" ?
In which release it will be available ? Any timelines ?

Thanks !!

@reta
Copy link
Collaborator Author

reta commented Dec 18, 2023

Java 8 support is getting added in the OpenSearch "Java Client" or "Java high-level REST client" ?

It is added to OpenSearch Rest Client (not "Java high-level REST client" ), for the OpenSearch "Java Client" - the change in under review opensearch-project/opensearch-java#767

@praveenchandna
Copy link

praveenchandna commented Jan 11, 2024

Hello
Here in the above reply you mentioned "OpenSearch Rest Client", to which client you are referring it to ? As per the list of clients in the below webpage I didn't found that. In this page two clients are mentioned for Java "OpenSearch Java Client" and "OpenSearch Java High-Level REST Client" .

https://opensearch.org/docs/latest/clients/

Sorry but just to avoid confusion, "OpenSearch Rest Client" and "OpenSearch Java High-Level REST Client" both are same ?

Java 8 support is restored in all which clients ?

Thanks !!

@reta
Copy link
Collaborator Author

reta commented Jan 11, 2024

Here in the above reply you mentioned "OpenSearch Rest Client", to which client you are referring it to ?

Hello @praveenchandna, this is the Rest Client from the OpenSearch core [1], which is one of the transports used by OpenSearch Java Client [2]. Thank you.

[1] https://github.com/opensearch-project/OpenSearch/tree/main/client/rest
[2] https://opensearch.org/docs/latest/clients/java/#installing-the-client-using-restclient-transport

@Hrvojeee
Copy link

Hrvojeee commented Feb 26, 2024

Hi @reta , please some help since I see your name all over the place so you must probably know; with the newly released opensearch-java 2.9.0 I was under the impression that I would be able to use the client in a Java 8 project. When I include the newly deployed artifact https://central.sonatype.com/artifact/org.opensearch.client/opensearch-java and try to instantiate either the Rest Client transport or the AwsSdk2Transport per docs https://opensearch.org/docs/latest/clients/java/#installing-the-client-using-restclient-transport , my project compiles fine against Java 8 but when I run the app with Java8 I get this:
nested exception is java.lang.UnsupportedClassVersionError: org/opensearch/client/util/ObjectBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Was the opensearch-java compiled with JDK11 or I'm doing something wrong or I missed the whole point of the Java8 support feature?

@reta
Copy link
Collaborator Author

reta commented Feb 26, 2024

Was the opensearch-java compiled with JDK11 or I'm doing something wrong or I missed the whole point of the Java8 support feature?

Hi @Hrvojeee , no you should not be missing the point here - your JDK-8 project should be working fine with opensearch-java as of 2.9.0. Do you mind sharing your dependencies tree? From the opensearch-java side, the JVM bytecode is JDK-8 (class file versions is 52.0), as javap shows:

$ javap  -v -classpath  ~/.m2/repository/org/opensearch/client/opensearch-java/2.9.0/opensearch-java-2.9.0.jar org/opensearch/client/util/ObjectBuilder
  Last modified Feb 22, 2024; size 252 bytes
  SHA-256 checksum 53575abaabe221f3ecaad3363e74a8090048ca517590a716cb09df9894811e12                                                                                                                                                                                                                                                                   
  Compiled from "ObjectBuilder.java"
public interface org.opensearch.client.util.ObjectBuilder<T extends java.lang.Object> 
  minor version: 0
  major version: 52
  flags: (0x0601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
  this_class: #1                          // org/opensearch/client/util/ObjectBuilder 
  super_class: #2                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 1, attributes: 2

@Hrvojeee
Copy link

Hrvojeee commented Feb 26, 2024

Ok this is embarrassing @reta, did not try javap to confirm. I must have had some older version of the opensearch-java lib on my classpath. When i did some mvn cleans its working fine. Sorry, stupid question, and thanks for the response!

@reta
Copy link
Collaborator Author

reta commented Feb 26, 2024

Ok this is embarrassing @reta, did not try javap to confirm.

Not a problem and thank you for trying it out

rayshrey pushed a commit to rayshrey/OpenSearch that referenced this pull request Mar 18, 2024
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport-failed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants