Skip to content

Commit

Permalink
Revert "HADOOP-12009 Clarify FileSystem.listStatus() sorting order & …
Browse files Browse the repository at this point in the history
…fix FileSystemContractBaseTest:testListStatus. (J.Andreina via stevel)"

This reverts commit 3dfa816.
  • Loading branch information
steveloughran committed Jun 30, 2015
1 parent 7ba5bba commit 076948d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
4 changes: 0 additions & 4 deletions hadoop-common-project/hadoop-common/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -664,10 +664,6 @@ Release 2.8.0 - UNRELEASED

HADOOP-11958. MetricsSystemImpl fails to show backtrace when an error
occurs (Jason Lowe via jeagles)

HADOOP-12009 Clarify FileSystem.listStatus() sorting order & fix
FileSystemContractBaseTest:testListStatus. (J.Andreina via stevel)

OPTIMIZATIONS

HADOOP-11785. Reduce the number of listStatus operation in distcp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,7 @@ public boolean accept(Path file) {
/**
* List the statuses of the files/directories in the given path if the path is
* a directory.
* <p>
* Does not guarantee to return the List of files/directories status in a
* sorted order.
*
* @param f given path
* @return the statuses of the files/directories in the given patch
* @throws FileNotFoundException when the path does not exist;
Expand Down Expand Up @@ -1542,9 +1540,6 @@ public RemoteIterator<Path> listCorruptFileBlocks(Path path)
/**
* Filter files/directories in the given path using the user-supplied path
* filter.
* <p>
* Does not guarantee to return the List of files/directories status in a
* sorted order.
*
* @param f
* a path name
Expand All @@ -1565,9 +1560,6 @@ public FileStatus[] listStatus(Path f, PathFilter filter)
/**
* Filter files/directories in the given list of paths using default
* path filter.
* <p>
* Does not guarantee to return the List of files/directories status in a
* sorted order.
*
* @param files
* a list of paths
Expand All @@ -1584,9 +1576,6 @@ public FileStatus[] listStatus(Path[] files)
/**
* Filter files/directories in the given list of paths using user-supplied
* path filter.
* <p>
* Does not guarantee to return the List of files/directories status in a
* sorted order.
*
* @param files
* a list of paths
Expand Down Expand Up @@ -1747,8 +1736,6 @@ public LocatedFileStatus next() throws IOException {
* while consuming the entries. Each file system implementation should
* override this method and provide a more efficient implementation, if
* possible.
* Does not guarantee to return the iterator that traverses statuses
* of the files in a sorted order.
*
* @param p target path
* @return remote iterator
Expand Down Expand Up @@ -1776,8 +1763,6 @@ public FileStatus next() throws IOException {

/**
* List the statuses and block locations of the files in the given path.
* Does not guarantee to return the iterator that traverses statuses
* of the files in a sorted order.
*
* If the path is a directory,
* if recursive is false, returns files in the directory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ to the same path:
forall fs in listStatus(Path) :
fs == getFileStatus(fs.path)

**Ordering of results**: there is no guarantee of ordering of the listed entries.
While HDFS currently returns an alphanumerically sorted list, neither the Posix `readdir()`
nor Java's `File.listFiles()` API calls define any ordering of returned values. Applications
which require a uniform sort order on the results must perform the sorting themselves.

### Atomicity and Consistency

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

import junit.framework.TestCase;

Expand Down Expand Up @@ -225,13 +224,9 @@ public void testListStatus() throws Exception {

paths = fs.listStatus(path("/test/hadoop"));
assertEquals(3, paths.length);
ArrayList<String> list = new ArrayList<String>();
for (FileStatus fileState : paths) {
list.add(fileState.getPath().toString());
}
assertTrue(list.contains(path("/test/hadoop/a")));
assertTrue(list.contains(path("/test/hadoop/b")));
assertTrue(list.contains(path("/test/hadoop/c")));
assertEquals(path("/test/hadoop/a"), paths[0].getPath());
assertEquals(path("/test/hadoop/b"), paths[1].getPath());
assertEquals(path("/test/hadoop/c"), paths[2].getPath());

paths = fs.listStatus(path("/test/hadoop/a"));
assertEquals(0, paths.length);
Expand Down

0 comments on commit 076948d

Please sign in to comment.