Class WALPerformanceEvaluationUtil

java.lang.Object
org.apache.hadoop.hbase.util.WALPerformanceEvaluationUtil

@Private public class WALPerformanceEvaluationUtil extends Object
This class contains code copied from HBaseTestingUtil and its super classes required by WALPerformanceEvaluation. This was done as part of refactoring for hbase-diagnostics module creation in HBASE-28432 to break cyclic dependency.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • dataTestDirOnTestFS

      private org.apache.hadoop.fs.Path dataTestDirOnTestFS
      Directory on test filesystem where we put the data for this instance of WALPerformanceEvaluationUtil
    • dataTestDir

      private File dataTestDir
      Directory where we put the data for this instance of WALPerformanceEvaluationUtil
    • BASE_TEST_DIRECTORY_KEY

      private static final String BASE_TEST_DIRECTORY_KEY
      System property key to get base test directory value
      See Also:
    • DEFAULT_BASE_TEST_DIRECTORY

      private static final String DEFAULT_BASE_TEST_DIRECTORY
      Default base directory for test output.
      See Also:
    • conf

      private org.apache.hadoop.conf.Configuration conf
  • Constructor Details

  • Method Details

    • getBaseTestDir

      private org.apache.hadoop.fs.Path getBaseTestDir()
      Returns:
      Where to write test data on local filesystem; usually DEFAULT_BASE_TEST_DIRECTORY Should not be used by the unit tests, hence its's private. Unit test will use a subdirectory of this directory.
      See Also:
    • getRandomUUID

      private static UUID getRandomUUID()
    • getRandomDir

      private org.apache.hadoop.fs.Path getRandomDir()
      Returns:
      A dir with a random (uuid) name under the test dir
      See Also:
    • createSubDir

      private void createSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName)
    • setupDataTestDir

      protected org.apache.hadoop.fs.Path setupDataTestDir()
      Home our data in a dir under DEFAULT_BASE_TEST_DIRECTORY. Give it a random name so can have many concurrent tests running if we need to. Moding a System property is not the way to do concurrent instances -- another instance could grab the temporary value unintentionally -- but not anything can do about it at moment; single instance only is how the minidfscluster works. We also create the underlying directory names for hadoop.log.dir, mapreduce.cluster.local.dir and hadoop.tmp.dir, and set the values in the conf, and as a system property for hadoop.tmp.dir (We do not create them!).
      Returns:
      The calculated data test build directory, if newly-created.
    • setupDataTestDirInternal

      private org.apache.hadoop.fs.Path setupDataTestDirInternal()
      Sets up a directory for a test to use.
      Returns:
      New directory path, if created.
    • createSubDirAndSystemProperty

      private void createSubDirAndSystemProperty(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName)
    • getTestFileSystem

      private org.apache.hadoop.fs.FileSystem getTestFileSystem() throws IOException
      Throws:
      IOException
    • getBaseTestDirOnTestFS

      private org.apache.hadoop.fs.Path getBaseTestDirOnTestFS() throws IOException
      Returns:
      Where to write test data on the test filesystem; Returns working directory for the test filesystem by default
      Throws:
      IOException
      See Also:
    • deleteOnExit

      private boolean deleteOnExit()
      Returns True if we should delete testing dirs on exit.
    • getDataTestDir

      private org.apache.hadoop.fs.Path getDataTestDir()
      Returns:
      Where to write test data on local filesystem, specific to the test. Useful for tests that do not use a cluster. Creates it if it does not exist already.
    • getNewDataTestDirOnTestFS

      private org.apache.hadoop.fs.Path getNewDataTestDirOnTestFS() throws IOException
      Sets up a new path in test filesystem to be used by tests.
      Throws:
      IOException
    • setupDataTestDirOnTestFS

      private void setupDataTestDirOnTestFS() throws IOException
      Sets up a path in test filesystem to be used by tests. Creates a new directory if not already setup.
      Throws:
      IOException
    • getDataTestDirOnTestFS

      private org.apache.hadoop.fs.Path getDataTestDirOnTestFS() throws IOException
      Returns a Path in the test filesystem, obtained from getTestFileSystem() to write temporary test data. Call this method after setting up the mini dfs cluster if the test relies on it.
      Returns:
      a unique path in the test filesystem
      Throws:
      IOException
    • getDataTestDirOnTestFS

      public org.apache.hadoop.fs.Path getDataTestDirOnTestFS(String subdirName) throws IOException
      Returns a Path in the test filesystem, obtained from getTestFileSystem() to write temporary test data. Call this method after setting up the mini dfs cluster if the test relies on it.
      Parameters:
      subdirName - name of the subdir to create under the base test dir
      Returns:
      a unique path in the test filesystem
      Throws:
      IOException