[ 
https://issues.apache.org/jira/browse/DRILL-5365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595755#comment-16595755
 ] 

ASF GitHub Bot commented on DRILL-5365:
---------------------------------------

sohami commented on a change in pull request #1296: DRILL-5365: Prevent plugin 
config from changing default fs. Make DrillFileSystem Immutable.
URL: https://github.com/apache/drill/pull/1296#discussion_r213508890
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/DrillFileSystem.java
 ##########
 @@ -79,32 +77,56 @@
 
   private final ConcurrentMap<DrillFSDataInputStream, DebugStackTrace> 
openedFiles = Maps.newConcurrentMap();
 
+  private final Configuration fsConf;
   private final FileSystem underlyingFs;
   private final OperatorStats operatorStats;
   private final CompressionCodecFactory codecFactory;
 
+  private boolean initialized = false;
+
   public DrillFileSystem(Configuration fsConf) throws IOException {
     this(fsConf, null);
   }
 
   public DrillFileSystem(Configuration fsConf, OperatorStats operatorStats) 
throws IOException {
-    this.underlyingFs = FileSystem.get(fsConf);
-    this.codecFactory = new CompressionCodecFactory(fsConf);
+    // Configuration objects are mutable, and the underlying FileSystem object 
may directly use a passed in Configuration.
+    // In order to avoid scenarios where a Configuration can change after a 
DrillFileSystem is created, we make a copy
+    // of the Configuration.
+    this.fsConf = new Configuration(fsConf);
 
 Review comment:
   We can convert `this.fsConf` to be a local variable and in `getConf()` do 
   `return new Configuration(underlyingFs.getConf());`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Enforce Immutability of DrillFileSystem
> ---------------------------------------
>
>                 Key: DRILL-5365
>                 URL: https://issues.apache.org/jira/browse/DRILL-5365
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Storage - Hive
>    Affects Versions: 1.10.0
>            Reporter: Chun Chang
>            Assignee: Timothy Farkas
>            Priority: Major
>             Fix For: 1.15.0
>
>
> This ticket was originally intended to track the issue reported by chun. 
> Since I did not discover the root cause for that issue, but clarified the 
> contract of DrillFileSystem and enforced it, I am repurposing this ticket to 
> track the improvements to Drill FileSystem. I've moved the original 
> FileNotFoundException issue to this ticket now 
> https://issues.apache.org/jira/browse/DRILL-6609 .
> This ticket now focuses on enforcing the immutability of the DrillFileSystem. 
> And removes usages of fs.default.name which is now deprecated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to