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

Josh Elser commented on HBASE-21247:
------------------------------------

{code:java}
+    String clsName = conf.get(key, defaultValue);
+    if (clsName != null && clsName.contains(".")) {
+      // first, try to interpret the conf value as class name for provider
+      try {
+        return (Class<? extends WALProvider>) Class.forName(clsName);
+      } catch (ClassNotFoundException exception) {
+        // try with enum key next
+      }
+    }{code}
"MyWalProvider" is technically a valid class name but wouldn't be returned by 
this method. What about using the set of enum values to determine if we should 
try to parse it as a class name? Instead of {{clsName != null && 
clsName.contains(".")}}, construct a {{Set<String>}} of the enum value name 
from {{Providers.values()}} and use that to determine if we should try to parse 
it as a class name (without changing the ordering of this method).

> Custom WAL Provider cannot be specified by configuration whose value is 
> outside the enums in Providers
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-21247
>                 URL: https://issues.apache.org/jira/browse/HBASE-21247
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>            Priority: Major
>             Fix For: 3.0.0
>
>         Attachments: 21247.v1.txt, 21247.v2.txt, 21247.v3.txt, 21247.v4.tst, 
> 21247.v4.txt, 21247.v5.txt, 21247.v6.txt
>
>
> Currently all the WAL Providers acceptable to hbase are specified in 
> Providers enum of WALFactory.
> This restricts the ability for additional WAL Providers to be supplied - by 
> class name.
> This issue fixes the bug by allowing the specification of new WAL Provider 
> class name using the config "hbase.wal.provider".



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

Reply via email to