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

[8.x] Add Hdfs patcher to replace deprecated Subject method #119781

Merged

Conversation

ldematte
Copy link
Contributor

@ldematte ldematte commented Jan 8, 2025

Backport of #119779

This backport is slightly more complex than the original on main, as Subject#current has been introduced with Java 18, and 8.x could still run on Java 17. Therefore, we need to check the runtime version to see if we can invoke it.

Tested by using:

./gradlew ":x-pack:plugin:searchable-snapshots:qa:hdfs:javaRestTest" --tests "org.elasticsearch.xpack.searchablesnapshots.hdfs.SecureHdfsSearchableSnapshotsIT.testSnapshotOfSearchableSnapshot" -Dtests.jvm.argline="-Des.entitlements.enabled=true" 

with both -Druntime.java=17 and -Druntime.java=23

@ldematte ldematte added >non-issue :Core/Infra/Core Core issues without another label backport v8.18.0 test-entitlements Trigger CI checks using security manager replacement labels Jan 8, 2025
@ldematte ldematte requested review from rjernst and a team January 8, 2025 17:24
mv.visitJumpInsn(GOTO, end);
mv.visitLabel(olderJdk);
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
mv.visitLabel(end);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When decompiled, Intellij shows this whole thing as

Subject subject = Runtime.version().feature() > 17 ? Subject.current() : Subject.getSubject(context);

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@ldematte ldematte merged commit 1d7872b into elastic:8.x Jan 9, 2025
15 checks passed
@ldematte ldematte deleted the backport/8.x/hdfs-get-subject-patcher branch January 9, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Core/Infra/Core Core issues without another label >non-issue test-entitlements Trigger CI checks using security manager replacement v8.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants