hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gera Shegalov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-11618) DelegateToFileSystem always uses default FS's default port
Date Sat, 07 Mar 2015 07:47:38 GMT

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

Gera Shegalov commented on HADOOP-11618:
----------------------------------------

Thanks for updating the patch, [~brahmareddy]. The latest patch still does not quite test
what was broken, and what I was suggesting in the previous comment. Although the test names
002 include defaultURI, they actually don't call {{FileSystem.setDefaultUri}}. 

It's a also not necessary to cast to (FtpFs). 

Both tests also should use the same ftp URI without port in both tests.
Assuming we move fs.AbstractFileSystem.ftp.impl to core-default.xml (I now think it makes
more sense), that is what I am looking for in the test class.
{code}
public class TestDelegateToFileSystem {

  private static final String FTP_DUMMYHOST = "ftp://dummyhost";
  private static final URI FTP_URI_NO_PORT = URI.create(FTP_DUMMYHOST);
  private static final URI FTP_URI_WITH_PORT =
      URI.create(FTP_DUMMYHOST + ":" + FTP.DEFAULT_PORT);

  private void testDefaultUriInternal(String defaultUri)
      throws UnsupportedFileSystemException {
    final Configuration conf = new Configuration();
    FileSystem.setDefaultUri(conf, defaultUri);
    final AbstractFileSystem ftpFs = AbstractFileSystem.get(FTP_URI_NO_PORT,
        conf);
    Assert.assertEquals(FTP_URI_WITH_PORT, ftpFs.getUri());
  }

  @Test
  public void testDefaultURIwithOutPort() throws Exception {
    testDefaultUriInternal("hdfs://dummyhost");
  }

  @Test
  public void testDefaultURIwithPort() throws Exception {
    testDefaultUriInternal("hdfs://dummyhost:8020");
  }
}
{code}

{{testDefaultURIwithPort}} without your fix breaks as explained:
{code}
java.lang.AssertionError: expected:<ftp://dummyhost:21> but was:<ftp://dummyhost:8020>
{code}

> DelegateToFileSystem always uses default FS's default port 
> -----------------------------------------------------------
>
>                 Key: HADOOP-11618
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11618
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.6.0
>            Reporter: Gera Shegalov
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-11618-001.patch, HADOOP-11618-002.patch, HADOOP-11618.patch
>
>
> DelegateToFileSystem constructor has the following code:
> {code}
>     super(theUri, supportedScheme, authorityRequired,
>         FileSystem.getDefaultUri(conf).getPort());
> {code}
> The default port should be taken from theFsImpl instead.
> {code}
>     super(theUri, supportedScheme, authorityRequired,
>         theFsImpl.getDefaultPort());
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message