Set context classloader to the one used to load the hdfs extension in HdfsDataSegmentPusher#1716
Set context classloader to the one used to load the hdfs extension in HdfsDataSegmentPusher#1716drcrallen wants to merge 1 commit intoapache:masterfrom
Conversation
drcrallen
commented
Sep 10, 2015
- Fixes druid-hdfs-storage errors when loaded via maven coordinates #1714
… HdfsDataSegmentPusher * Fixes apache#1714
|
@himanshug I'm not sure if this will cause *.xml files on the execution classpath to be not found. Do you know any good ways to test that this doesn't clobber hdfs-site.xml and other configs? |
|
I don't think this will necessarily fix the issue because FileSystem caches a scheme to FileSystem map at class level. So, if even a single FileSystem.getFileSystem() call happens before this code is reached, setting this classloader will not do anything. This patch will make things unpredictable depending upon whether FileSystem builds the cache on call to this code or before. regarding clobbering, yes it might(and unpredictably so) as Configuration really caches stuff at class level first time it is used. |
|
@himanshug I think your HDFS patch is the better solution, and I agree with your assessment about the unpredictability in class-level caching (noted in #1714 (comment) , should have noted here as well). As such I'm closing this PR since this will only make things more unsteady in general, while only solving a very specific use case. |
|
@drcrallen thought more today, and this can work if we ensure that classloader switch happens before FileSystem internal initialization , which can be made possible by forcing it inside HdfsStorageDruidModule . |