Revert "HADOOP-12009 Clarify FileSystem.listStatus() sorting order & fix FileSystemContractBaseTest:testListStatus. (J.Andreina via stevel)"
This reverts commit f02c06965c
.
This commit is contained in:
parent
bc06d5b041
commit
6719fc94e1
|
@ -163,10 +163,6 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-11958. MetricsSystemImpl fails to show backtrace when an error
|
HADOOP-11958. MetricsSystemImpl fails to show backtrace when an error
|
||||||
occurs (Jason Lowe via jeagles)
|
occurs (Jason Lowe via jeagles)
|
||||||
|
|
||||||
HADOOP-12009 Clarify FileSystem.listStatus() sorting order & fix
|
|
||||||
FileSystemContractBaseTest:testListStatus. (J.Andreina via stevel)
|
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
||||||
|
|
|
@ -1498,9 +1498,7 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
/**
|
/**
|
||||||
* List the statuses of the files/directories in the given path if the path is
|
* List the statuses of the files/directories in the given path if the path is
|
||||||
* a directory.
|
* a directory.
|
||||||
* <p>
|
*
|
||||||
* Does not guarantee to return the List of files/directories status in a
|
|
||||||
* sorted order.
|
|
||||||
* @param f given path
|
* @param f given path
|
||||||
* @return the statuses of the files/directories in the given patch
|
* @return the statuses of the files/directories in the given patch
|
||||||
* @throws FileNotFoundException when the path does not exist;
|
* @throws FileNotFoundException when the path does not exist;
|
||||||
|
@ -1542,9 +1540,6 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Filter files/directories in the given path using the user-supplied path
|
* Filter files/directories in the given path using the user-supplied path
|
||||||
* filter.
|
* filter.
|
||||||
* <p>
|
|
||||||
* Does not guarantee to return the List of files/directories status in a
|
|
||||||
* sorted order.
|
|
||||||
*
|
*
|
||||||
* @param f
|
* @param f
|
||||||
* a path name
|
* a path name
|
||||||
|
@ -1565,9 +1560,6 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Filter files/directories in the given list of paths using default
|
* Filter files/directories in the given list of paths using default
|
||||||
* path filter.
|
* path filter.
|
||||||
* <p>
|
|
||||||
* Does not guarantee to return the List of files/directories status in a
|
|
||||||
* sorted order.
|
|
||||||
*
|
*
|
||||||
* @param files
|
* @param files
|
||||||
* a list of paths
|
* a list of paths
|
||||||
|
@ -1584,9 +1576,6 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Filter files/directories in the given list of paths using user-supplied
|
* Filter files/directories in the given list of paths using user-supplied
|
||||||
* path filter.
|
* path filter.
|
||||||
* <p>
|
|
||||||
* Does not guarantee to return the List of files/directories status in a
|
|
||||||
* sorted order.
|
|
||||||
*
|
*
|
||||||
* @param files
|
* @param files
|
||||||
* a list of paths
|
* a list of paths
|
||||||
|
@ -1748,8 +1737,6 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
* while consuming the entries. Each file system implementation should
|
* while consuming the entries. Each file system implementation should
|
||||||
* override this method and provide a more efficient implementation, if
|
* override this method and provide a more efficient implementation, if
|
||||||
* possible.
|
* possible.
|
||||||
* Does not guarantee to return the iterator that traverses statuses
|
|
||||||
* of the files in a sorted order.
|
|
||||||
*
|
*
|
||||||
* @param p target path
|
* @param p target path
|
||||||
* @return remote iterator
|
* @return remote iterator
|
||||||
|
@ -1777,8 +1764,6 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List the statuses and block locations of the files in the given path.
|
* 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 the path is a directory,
|
||||||
* if recursive is false, returns files in the directory;
|
* if recursive is false, returns files in the directory;
|
||||||
|
|
|
@ -183,10 +183,6 @@ to the same path:
|
||||||
forall fs in listStatus(Path) :
|
forall fs in listStatus(Path) :
|
||||||
fs == getFileStatus(fs.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
|
### Atomicity and Consistency
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.hadoop.fs;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
@ -204,13 +203,9 @@ public abstract class FileSystemContractBaseTest extends TestCase {
|
||||||
|
|
||||||
paths = fs.listStatus(path("/test/hadoop"));
|
paths = fs.listStatus(path("/test/hadoop"));
|
||||||
assertEquals(3, paths.length);
|
assertEquals(3, paths.length);
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
assertEquals(path("/test/hadoop/a"), paths[0].getPath());
|
||||||
for (FileStatus fileState : paths) {
|
assertEquals(path("/test/hadoop/b"), paths[1].getPath());
|
||||||
list.add(fileState.getPath().toString());
|
assertEquals(path("/test/hadoop/c"), paths[2].getPath());
|
||||||
}
|
|
||||||
assertTrue(list.contains(path("/test/hadoop/a")));
|
|
||||||
assertTrue(list.contains(path("/test/hadoop/b")));
|
|
||||||
assertTrue(list.contains(path("/test/hadoop/c")));
|
|
||||||
|
|
||||||
paths = fs.listStatus(path("/test/hadoop/a"));
|
paths = fs.listStatus(path("/test/hadoop/a"));
|
||||||
assertEquals(0, paths.length);
|
assertEquals(0, paths.length);
|
||||||
|
|
Loading…
Reference in New Issue