[
https://issues.apache.org/jira/browse/HDFS-4983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13841655#comment-13841655
]
Haohui Mai commented on HDFS-4983:
----------------------------------
bq. About the static block, the intention is that it always get executed when
the class is loaded, so to assure the default is initialized correctly.
The execution order of static blocks has been a long headache for us. The order
is determined by the Java class loader and it is unpredictable. I would much
rather to make the initialization explicit. It makes things much easier to
debug.
bq. I made the userPattern string static, and made it retrievable by the test
code (please refer to the change in TestParam.java), and annotated as
visibleForTesting.
What I'm saying is that you don't need the userPattern field at all -- you can
just compile the pattern and store it in the domain field. The code seems
redundant to me and can go away.
bq. About the property name, I think "webhdfs.....", meant to be consistent
with the counterpart "httpfs...". And this is what the original bug requested.
What httpfs does is irrelevant. We have dfs.webhdfs.enabled already, so please
make it consistent.
bq. I made the public interface setUserPattern(Configuration) instead of
setUserPattern(String), so if in the future we want to set something
differently based on other configuration, we can just change inside UserParam
class without changing the caller.
Configuration in UserPattern seems a wrong abstraction to me. For no apparent
reasons UserParams depends on Configuration now. If later we want to build a
thin webhdfs client and to reuse the class, it can be problematic. If this is
not a big deal for you. I appreciate you can fix it.
> Numeric usernames do not work with WebHDFS FS
> ---------------------------------------------
>
> Key: HDFS-4983
> URL: https://issues.apache.org/jira/browse/HDFS-4983
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: webhdfs
> Affects Versions: 2.0.0-alpha
> Reporter: Harsh J
> Assignee: Yongjun Zhang
> Labels: patch
> Attachments: HDFS-4983.001.patch, HDFS-4983.002.patch,
> HDFS-4983.003.patch, HDFS-4983.004.patch, HDFS-4983.005.patch
>
>
> Per the file
> hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/UserParam.java,
> the DOMAIN pattern is set to: {{^[A-Za-z_][A-Za-z0-9._-]*[$]?$}}.
> Given this, using a username such as "123" seems to fail for some reason
> (tried on insecure setup):
> {code}
> [123@host-1 ~]$ whoami
> 123
> [123@host-1 ~]$ hadoop fs -fs webhdfs://host-2.domain.com -ls /
> -ls: Invalid value: "123" does not belong to the domain
> ^[A-Za-z_][A-Za-z0-9._-]*[$]?$
> Usage: hadoop fs [generic options] -ls [-d] [-h] [-R] [<path> ...]
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)