HADOOP-19833. Fix fs.s3a.classloader.isolation=false by using classlo…#8303
Open
deepujain wants to merge 4 commits intoapache:trunkfrom
Open
HADOOP-19833. Fix fs.s3a.classloader.isolation=false by using classlo…#8303deepujain wants to merge 4 commits intoapache:trunkfrom
deepujain wants to merge 4 commits intoapache:trunkfrom
Conversation
…ader from Configuration in getInstanceFromReflection. When isolation is false, use conf.getClassLoader(); if null use thread context classloader so instance creation respects non-isolated loading.
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description — copy into GitHub when opening the PR (do not commit this file)
HADOOP-19833. Fix fs.s3a.classloader.isolation=false by using classloader from Configuration in getInstanceFromReflection
Problem
The configuration
fs.s3a.classloader.isolation=false(introduced in HADOOP-18993) does not work as intended. The isolation flag is stored correctly in the Hadoop Configuration, but when creating instances viaS3AUtils.getInstanceFromReflection, the classloader was always taken fromconf.getClassLoader()without considering the isolation flag. When isolation is disabled, the Configuration may not have had its classloader set (e.g.maybeIsolateClassloaderdoes not set it when isolation=false), so we must explicitly respect the flag and, when isolation is false, use the Configuration's classloader when set, otherwise the thread context classloader so that loading is not forced to use an isolated S3A classloader.Change
In
S3AUtils.getInstanceFromReflection:conf != nullandfs.s3a.classloader.isolationis true (default): keep usingconf.getClassLoader()(set bymaybeIsolateClassloaderto the S3A classloader).conf != nullandfs.s3a.classloader.isolationis false: use the classloader from the Configuration (conf.getClassLoader()); if that is null, useThread.currentThread().getContextClassLoader()so that classes are loaded from the application classpath.S3AUtils.class.getClassLoader()for backward compatibility.This ensures that when users set
fs.s3a.classloader.isolation=false, instance creation uses the Configuration's classloader (or the context classloader) instead of always using the S3A isolated classloader.Why no new tests
Existing test
ITestS3AFileSystemIsolatedClassloaderalready validates isolation=true and isolation=false; the fix aligns runtime behavior with that test’s expectations. No new tests needed.JIRA
Fixes HADOOP-19833