Package org.apache.hadoop.hbase.io
Class TestFileLink
java.lang.Object
org.apache.hadoop.hbase.io.TestFileLink
Test that FileLink switches between alternate locations when the current location moves or gets
deleted.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voiddataVerify(byte[] data, int n, byte v) Verify that all bytes in 'data' have 'v' as value.private static voidskipBuffer(org.apache.hadoop.fs.FSDataInputStream in, byte v) voidvoidTest that the returned link fromFileLink.open(FileSystem)can be unwrapped to aHdfsDataInputStreambyFileLink.getUnderlyingFileLinkInputStream(FSDataInputStream)voidvoidTest that link is still readable even when the current file gets deleted.voidTest, on HDFS, that the FileLink is still readable even when the current file gets renamed.private voidtestLinkReadDuringRename(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir) Test that link is still readable even when the current file gets renamed.voidvoidTest, on a local filesystem, that the FileLink is still readable even when the current file gets renamed.private voidwriteSomeData(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, long size, byte v) Write up to 'size' bytes with value 'v' into a new file called 'path'.
-
Field Details
-
CLASS_RULE
-
-
Constructor Details
-
TestFileLink
public TestFileLink()
-
-
Method Details
-
testEquals
-
testHashCode
-
testGetUnderlyingFSDataInputStream
Test that the returned link fromFileLink.open(FileSystem)can be unwrapped to aHdfsDataInputStreambyFileLink.getUnderlyingFileLinkInputStream(FSDataInputStream)- Throws:
Exception
-
testHDFSLinkReadDuringRename
Test, on HDFS, that the FileLink is still readable even when the current file gets renamed.- Throws:
Exception
-
testLinkReadWithMissingFile
- Throws:
Exception
-
testLocalLinkReadDuringRename
Test, on a local filesystem, that the FileLink is still readable even when the current file gets renamed.- Throws:
IOException
-
testLinkReadDuringRename
private void testLinkReadDuringRename(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir) throws IOException Test that link is still readable even when the current file gets renamed.- Throws:
IOException
-
testHDFSLinkReadDuringDelete
Test that link is still readable even when the current file gets deleted. NOTE: This test is valid only on HDFS. When a file is deleted from a local file-system, it is simply 'unlinked'. The inode, which contains the file's data, is not deleted until all processes have finished with it. In HDFS when the request exceed the cached block locations, a query to the namenode is performed, using the filename, and the deleted file doesn't exists anymore (FileNotFoundException).- Throws:
Exception
-
writeSomeData
private void writeSomeData(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, long size, byte v) throws IOException Write up to 'size' bytes with value 'v' into a new file called 'path'.- Throws:
IOException
-
dataVerify
Verify that all bytes in 'data' have 'v' as value. -
skipBuffer
private static void skipBuffer(org.apache.hadoop.fs.FSDataInputStream in, byte v) throws IOException - Throws:
IOException
-