You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Alejandro Abdelnur (JIRA)" <ji...@apache.org> on 2009/01/09 08:20:59 UTC

[jira] Created: (HADOOP-5000) A Configuration instance cannot be reloaded if the configuration has InputStream resources

A Configuration instance cannot be reloaded if the configuration has InputStream resources
------------------------------------------------------------------------------------------

                 Key: HADOOP-5000
                 URL: https://issues.apache.org/jira/browse/HADOOP-5000
             Project: Hadoop Core
          Issue Type: Bug
         Environment: all
            Reporter: Alejandro Abdelnur


If a {{Configuration}} instance as a stream resource, on an reload of configuration values, the {{loadResource}} method will fail because the stream has been already read in the first {{loadResource}} invocation.

For example:

{code}
InputStream is = ....
Configuration conf = new Configuration();
conf.addResource(is);
conf.set("a", "A");
conf.reloadConfiguration();
conf.set("a","B");
{code}

This example will fail on {{conf.set("b", "B");}} because it a {{loadResources()}} will be done and the {{InputStream}} has been already consumed.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5000) A Configuration instance cannot be reloaded if the configuration has InputStream resources

Posted by "Alejandro Abdelnur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662263#action_12662263 ] 

Alejandro Abdelnur commented on HADOOP-5000:
--------------------------------------------

Either the javadocs should specify this behavior or stream resources should be read and stored in a private {{Properties}} instance that is applied to the {{Configuration}} on {{loadResources}} invocation, instead of trying to reread the stream.

And creating a new {{Configuration}} from an existing one does not fix the problem because the constructor copies the resources, not the values.


> A Configuration instance cannot be reloaded if the configuration has InputStream resources
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-5000
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5000
>             Project: Hadoop Core
>          Issue Type: Bug
>         Environment: all
>            Reporter: Alejandro Abdelnur
>
> If a {{Configuration}} instance as a stream resource, on an reload of configuration values, the {{loadResource}} method will fail because the stream has been already read in the first {{loadResource}} invocation.
> For example:
> {code}
> InputStream is = ....
> Configuration conf = new Configuration();
> conf.addResource(is);
> conf.set("a", "A");
> conf.reloadConfiguration();
> conf.set("a","B");
> {code}
> This example will fail on {{conf.set("b", "B");}} because it a {{loadResources()}} will be done and the {{InputStream}} has been already consumed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5000) A Configuration instance cannot be reloaded if the configuration has InputStream resources

Posted by "Alejandro Abdelnur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662902#action_12662902 ] 

Alejandro Abdelnur commented on HADOOP-5000:
--------------------------------------------

Another options:

3. add a constructor that takes an InputStream
4. add a {{readXML(InputStream)}} method

Looking at when this was added, it was added as part of HADOOP-3702 (I did part of it) based on suggestions on how to serialize/deserialize configurations to/from a string.

But is seems that a later refactoring changed how this is done.

My problem is that we've started using this method because we need to stream configurations and recreate them from the stream on the other end.

I would be happy with #2, #3 or #4. Maybe be for symmetry #4 is the most appropriate approach.


> A Configuration instance cannot be reloaded if the configuration has InputStream resources
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-5000
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5000
>             Project: Hadoop Core
>          Issue Type: Bug
>         Environment: all
>            Reporter: Alejandro Abdelnur
>
> If a {{Configuration}} instance as a stream resource, on an reload of configuration values, the {{loadResource}} method will fail because the stream has been already read in the first {{loadResource}} invocation.
> For example:
> {code}
> InputStream is = ....
> Configuration conf = new Configuration();
> conf.addResource(is);
> conf.set("a", "A");
> conf.reloadConfiguration();
> conf.set("a","B");
> {code}
> This example will fail on {{conf.set("b", "B");}} because it a {{loadResources()}} will be done and the {{InputStream}} has been already consumed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HADOOP-5000) A Configuration instance cannot be reloaded if the configuration has InputStream resources

Posted by "Owen O'Malley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HADOOP-5000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662447#action_12662447 ] 

Owen O'Malley commented on HADOOP-5000:
---------------------------------------

I think we either need to:
  1. Remove the ability to add InputStreams to Configurations.
  2. Read and store the InputStream as a Map<String,String>.

What is the need for adding InputStreams to configurations?

> A Configuration instance cannot be reloaded if the configuration has InputStream resources
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-5000
>                 URL: https://issues.apache.org/jira/browse/HADOOP-5000
>             Project: Hadoop Core
>          Issue Type: Bug
>         Environment: all
>            Reporter: Alejandro Abdelnur
>
> If a {{Configuration}} instance as a stream resource, on an reload of configuration values, the {{loadResource}} method will fail because the stream has been already read in the first {{loadResource}} invocation.
> For example:
> {code}
> InputStream is = ....
> Configuration conf = new Configuration();
> conf.addResource(is);
> conf.set("a", "A");
> conf.reloadConfiguration();
> conf.set("a","B");
> {code}
> This example will fail on {{conf.set("b", "B");}} because it a {{loadResources()}} will be done and the {{InputStream}} has been already consumed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.