HADOOP-12618. Fix NPE in TestSequenceFile. (Brahma Reddy Battula via umamahesh)
(cherry picked from commit ad53c52063
)
This commit is contained in:
parent
5bc33c5ae4
commit
9c5650cf03
|
@ -354,6 +354,8 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12600. FileContext and AbstractFileSystem should be annotated as a
|
HADOOP-12600. FileContext and AbstractFileSystem should be annotated as a
|
||||||
Stable interface. (cnauroth)
|
Stable interface. (cnauroth)
|
||||||
|
|
||||||
|
HADOOP-12618. Fix NPE in TestSequenceFile. (Brahma Reddy Battula via umamahesh)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
||||||
|
|
|
@ -130,6 +130,7 @@ public class TestSequenceFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void writeTest(FileSystem fs, int count, int seed, Path file,
|
private void writeTest(FileSystem fs, int count, int seed, Path file,
|
||||||
CompressionType compressionType, CompressionCodec codec)
|
CompressionType compressionType, CompressionCodec codec)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -150,6 +151,7 @@ public class TestSequenceFile {
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void readTest(FileSystem fs, int count, int seed, Path file)
|
private void readTest(FileSystem fs, int count, int seed, Path file)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
LOG.debug("reading " + count + " records");
|
LOG.debug("reading " + count + " records");
|
||||||
|
@ -216,6 +218,7 @@ public class TestSequenceFile {
|
||||||
LOG.info("done sorting " + count + " debug");
|
LOG.info("done sorting " + count + " debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void checkSort(FileSystem fs, int count, int seed, Path file)
|
private void checkSort(FileSystem fs, int count, int seed, Path file)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
LOG.info("sorting " + count + " records in memory for debug");
|
LOG.info("sorting " + count + " records in memory for debug");
|
||||||
|
@ -253,6 +256,7 @@ public class TestSequenceFile {
|
||||||
LOG.debug("sucessfully checked " + count + " records");
|
LOG.debug("sucessfully checked " + count + " records");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void mergeTest(FileSystem fs, int count, int seed, Path file,
|
private void mergeTest(FileSystem fs, int count, int seed, Path file,
|
||||||
CompressionType compressionType,
|
CompressionType compressionType,
|
||||||
boolean fast, int factor, int megabytes)
|
boolean fast, int factor, int megabytes)
|
||||||
|
@ -375,6 +379,7 @@ public class TestSequenceFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private SequenceFile.Metadata readMetadata(FileSystem fs, Path file)
|
private SequenceFile.Metadata readMetadata(FileSystem fs, Path file)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
LOG.info("reading file: " + file.toString());
|
LOG.info("reading file: " + file.toString());
|
||||||
|
@ -384,6 +389,7 @@ public class TestSequenceFile {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private void writeMetadataTest(FileSystem fs, int count, int seed, Path file,
|
private void writeMetadataTest(FileSystem fs, int count, int seed, Path file,
|
||||||
CompressionType compressionType, CompressionCodec codec, SequenceFile.Metadata metadata)
|
CompressionType compressionType, CompressionCodec codec, SequenceFile.Metadata metadata)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -413,6 +419,7 @@ public class TestSequenceFile {
|
||||||
sorter.sort(new Path[] { unsortedFile }, sortedFile, false);
|
sorter.sort(new Path[] { unsortedFile }, sortedFile, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testClose() throws IOException {
|
public void testClose() throws IOException {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
|
@ -470,6 +477,7 @@ public class TestSequenceFile {
|
||||||
* Test that makes sure the FileSystem passed to createWriter
|
* Test that makes sure the FileSystem passed to createWriter
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUsesFsArg() throws Exception {
|
public void testCreateUsesFsArg() throws Exception {
|
||||||
FileSystem fs = FileSystem.getLocal(conf);
|
FileSystem fs = FileSystem.getLocal(conf);
|
||||||
|
@ -499,6 +507,7 @@ public class TestSequenceFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testCloseForErroneousSequenceFile()
|
public void testCloseForErroneousSequenceFile()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -555,6 +564,7 @@ public class TestSequenceFile {
|
||||||
* already created
|
* already created
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateWriterOnExistingFile() throws IOException {
|
public void testCreateWriterOnExistingFile() throws IOException {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
|
@ -568,6 +578,7 @@ public class TestSequenceFile {
|
||||||
CompressionType.NONE, null, new Metadata());
|
CompressionType.NONE, null, new Metadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testRecursiveSeqFileCreate() throws IOException {
|
public void testRecursiveSeqFileCreate() throws IOException {
|
||||||
FileSystem fs = FileSystem.getLocal(conf);
|
FileSystem fs = FileSystem.getLocal(conf);
|
||||||
|
@ -661,7 +672,7 @@ public class TestSequenceFile {
|
||||||
Path file = null;
|
Path file = null;
|
||||||
int seed = new Random().nextInt();
|
int seed = new Random().nextInt();
|
||||||
|
|
||||||
String usage = "Usage: SequenceFile " +
|
String usage = "Usage: testsequencefile " +
|
||||||
"[-count N] " +
|
"[-count N] " +
|
||||||
"[-seed #] [-check] [-compressType <NONE|RECORD|BLOCK>] " +
|
"[-seed #] [-check] [-compressType <NONE|RECORD|BLOCK>] " +
|
||||||
"-codec <compressionCodec> " +
|
"-codec <compressionCodec> " +
|
||||||
|
@ -751,7 +762,9 @@ public class TestSequenceFile {
|
||||||
test.checkSort(fs, count, seed, file);
|
test.checkSort(fs, count, seed, file);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (fs != null) {
|
||||||
fs.close();
|
fs.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue