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

James Taylor commented on PHOENIX-3994:
---------------------------------------

Thanks for the updated patch, [~samarthjain]. Would you mind filing an HBase 
JIRA for the Configuration clone issue and reference it in your new clone util? 
It's possible that there's a workaround or we're doing something wrong. Also, 
shouldn't the clone util create an empty Configuration and then loop through 
the one passed in to set all the values?
{code}
+
+    /**
+     * Utility to work around the limitation of the copy constructor
+     * {@link Configuration#Configuration(Configuration)} provided by the 
{@link Configuration}
+     * class. The copy constructor doesn't copy all the config settings, so we 
need to resort to
+     * iterating through all the settings and setting it on the cloned config.
+     * @param toCopy  configuration to copy
+     * @return
+     */
+    public static Configuration cloneConfig(Configuration toCopy) {
          // Create empty config and manually set all values due to copy 
constructor not working (HBASE-####)
+        Configuration clone = new Configuration();
+        Iterator<Entry<String, String>> iterator = toCopy.iterator();
+        while (iterator.hasNext()) {
+            Entry<String, String> entry = iterator.next();
+            clone.set(entry.getKey(), entry.getValue());
+        }
+        return clone;
+    }
{code}

+1 after these minor tweaks.

> Index RPC priority still depends on the controller factory property in 
> hbase-site.xml
> -------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-3994
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3994
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.11.0
>            Reporter: Sergey Soldatov
>            Assignee: Samarth Jain
>            Priority: Critical
>             Fix For: 4.12.0, 4.11.1
>
>         Attachments: PHOENIX-3994_addendum.patch, PHOENIX-3994.patch, 
> PHOENIX-3994_v2.patch, PHOENIX-3994_v3.patch, PHOENIX-3994_v4.patch
>
>
> During PHOENIX-3360 we tried to remove dependency on 
> hbase.rpc.controllerfactory.class property in hbase-site.xml since it cause 
> problems on the client side (if client is using server side configuration, 
> all client request may go using index priority). Committed solution is using 
> setting the controller factory programmatically for coprocessor environment 
> in Indexer class, but it comes that this solution doesn't work because the 
> environment configuration is not used for the coprocessor connection 
> creation. We need to provide a better solution since this issue may cause 
> accidental locks and failures that hard to identify and avoid. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to