[
https://issues.apache.org/jira/browse/HBASE-8240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13622211#comment-13622211
]
Ted Yu commented on HBASE-8240:
-------------------------------
bq. I suppose it is ok because base Configuration does this.
That's right. Query to ImmutableConfigMap always uses String parameter:
{code}
public String get(String key) {
{code}
bq. Do we have to save up all of the Configuation into a HashMap
This is done so that the returned iterator doesn't give user duplicate keys.
See my comment above:
bq. I tried CompositeIterator approach but its semantics is not correct:
iterator would return multiple values for the same key.
bq. Where do we need this functionatlity?
This is needed in FileSystem.get(Configuration) call. hadoop 2.0 expects a
mutable Configuration. We would get the following if CompoundConfiguration is
passed:
{code}
java.lang.UnsupportedOperationException: Immutable Configuration
at
org.apache.hadoop.hbase.CompoundConfiguration.setClass(CompoundConfiguration.java:474)
at org.apache.hadoop.ipc.RPC.setProtocolEngine(RPC.java:193)
at
org.apache.hadoop.hdfs.NameNodeProxies.createNNProxyWithClientProtocol(NameNodeProxies.java:249)
at
org.apache.hadoop.hdfs.NameNodeProxies.createNonHAProxy(NameNodeProxies.java:168)
at
org.apache.hadoop.hdfs.NameNodeProxies.createProxy(NameNodeProxies.java:129)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:421)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:388)
at
org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:125)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2277)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:86)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2311)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2293)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:317)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:163)
{code}
So this JIRA should go into 0.95 as well.
> CompoundConfiguration should implement Iterable
> -----------------------------------------------
>
> Key: HBASE-8240
> URL: https://issues.apache.org/jira/browse/HBASE-8240
> Project: HBase
> Issue Type: Improvement
> Reporter: Ted Yu
> Assignee: Ted Yu
> Fix For: 0.98.0
>
> Attachments: 8240-v1.txt, 8240-v2.txt, 8240-v3.txt, 8240-v4.txt,
> 8240-v6.txt
>
>
> Here is from hadoop Configuration class:
> {code}
> public class Configuration implements Iterable<Map.Entry<String,String>>,
> {code}
> There're 3 addXX() methods for CompoundConfiguration:
> {code}
> public CompoundConfiguration add(final Configuration conf) {
> public CompoundConfiguration addWritableMap(
> final Map<ImmutableBytesWritable, ImmutableBytesWritable> map) {
> public CompoundConfiguration addStringMap(final Map<String, String> map) {
> {code}
> Parameters to these methods all support iteration.
> We can enhance ImmutableConfigMap with the following new method:
> {code}
> public abstract java.util.Iterator iterator();
> {code}
> Then the following method of CompoundConfiguration can be implemented:
> {code}
> public Iterator<Map.Entry<String, String>> iterator() {
> {code}
> This enhancement would be useful in scenario where a mutable Configuration is
> required.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira