Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-6175

TestFSUtils flaky on hdfs getFileStatus method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 0.94.4, 0.95.2
    • 0.94.4, 0.95.0
    • test
    • None

    Description

      This is a simplified version of a TestFSUtils issue: a sleep and the test works 100% of the time. No sleep and it becomes flaky. Root cause unknown. While the issue appears on the tests, the root cause could be an issue on real production system as well.

      @Test
       public void testFSUTils() throws Exception {
         final String hosts[] = {"host1", "host2", "host3", "host4"};
         Path testFile = new Path("/test1.txt");
      
         HBaseTestingUtility htu = new HBaseTestingUtility();
      
         try {
           htu.startMiniDFSCluster(hosts).waitActive();
           FileSystem fs = htu.getDFSCluster().getFileSystem();
      
           for (int i = 0; i < 100; ++i) {
             FSDataOutputStream out = fs.create(testFile);
             byte[] data = new byte[1];
             out.write(data, 0, 1);
             out.close();
      
             // Put a sleep here to make me work
             //Thread.sleep(2000);
      
             FileStatus status = fs.getFileStatus(testFile);
             HDFSBlocksDistribution blocksDistribution =
               FSUtils.computeHDFSBlocksDistribution(fs, status, 0, status.getLen());
             assertEquals("Wrong number of hosts distributing blocks. at
      iteration "+i, 3,
               blocksDistribution.getTopHosts().size());
      
             fs.delete(testFile, true);
           }
         } finally {
           htu.shutdownMiniDFSCluster();
         }
       }
      

      Attachments

        1. 6175.v1.patch
          4 kB
          Nicolas Liochon

        Issue Links

          Activity

            People

              nkeywal Nicolas Liochon
              nkeywal Nicolas Liochon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: