Class TestFileLink

java.lang.Object
org.apache.hadoop.hbase.io.TestFileLink

public class TestFileLink extends Object
Test that FileLink switches between alternate locations when the current location moves or gets deleted.
  • Field Details

  • Constructor Details

  • Method Details

    • testEquals

      public void testEquals()
    • testHashCode

      public void testHashCode()
    • testGetUnderlyingFSDataInputStream

      Test that the returned link from FileLink.open(FileSystem) can be unwrapped to a HdfsDataInputStream by FileLink.getUnderlyingFileLinkInputStream(FSDataInputStream)
      Throws:
      Exception
    • testHDFSLinkReadDuringRename

      Test, on HDFS, that the FileLink is still readable even when the current file gets renamed.
      Throws:
      Exception
    • testLinkReadWithMissingFile

      public void testLinkReadWithMissingFile() throws Exception
      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

      private static void dataVerify(byte[] data, int n, byte v)
      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