Package org.apache.hadoop.hbase.util
Class WALPerformanceEvaluationUtil
java.lang.Object
org.apache.hadoop.hbase.util.WALPerformanceEvaluationUtil
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringSystem property key to get base test directory valueprivate org.apache.hadoop.conf.Configurationprivate FileDirectory where we put the data for this instance of WALPerformanceEvaluationUtilprivate org.apache.hadoop.fs.PathDirectory on test filesystem where we put the data for this instance of WALPerformanceEvaluationUtilprivate static final StringDefault base directory for test output.private static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcreateSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) private voidcreateSubDirAndSystemProperty(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) private booleanReturns True if we should delete testing dirs on exit.private org.apache.hadoop.fs.Pathprivate org.apache.hadoop.fs.Pathprivate org.apache.hadoop.fs.Pathprivate org.apache.hadoop.fs.PathReturns a Path in the test filesystem, obtained fromgetTestFileSystem()to write temporary test data.org.apache.hadoop.fs.PathgetDataTestDirOnTestFS(String subdirName) Returns a Path in the test filesystem, obtained fromgetTestFileSystem()to write temporary test data.private org.apache.hadoop.fs.PathSets up a new path in test filesystem to be used by tests.private org.apache.hadoop.fs.Pathprivate static UUIDprivate org.apache.hadoop.fs.FileSystemprotected org.apache.hadoop.fs.PathHome our data in a dir underDEFAULT_BASE_TEST_DIRECTORY.private org.apache.hadoop.fs.PathSets up a directory for a test to use.private voidSets up a path in test filesystem to be used by tests.
-
Field Details
-
LOG
-
dataTestDirOnTestFS
Directory on test filesystem where we put the data for this instance of WALPerformanceEvaluationUtil -
dataTestDir
Directory where we put the data for this instance of WALPerformanceEvaluationUtil -
BASE_TEST_DIRECTORY_KEY
System property key to get base test directory value- See Also:
-
DEFAULT_BASE_TEST_DIRECTORY
Default base directory for test output.- See Also:
-
conf
-
-
Constructor Details
-
WALPerformanceEvaluationUtil
-
-
Method Details
-
getBaseTestDir
- Returns:
- Where to write test data on local filesystem; usually
DEFAULT_BASE_TEST_DIRECTORYShould not be used by the unit tests, hence its's private. Unit test will use a subdirectory of this directory. - See Also:
-
getRandomUUID
-
getRandomDir
- Returns:
- A dir with a random (uuid) name under the test dir
- See Also:
-
createSubDir
-
setupDataTestDir
Home our data in a dir underDEFAULT_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
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
- Throws:
IOException
-
getBaseTestDirOnTestFS
- Returns:
- Where to write test data on the test filesystem; Returns working directory for the test filesystem by default
- Throws:
IOException- See Also:
-
deleteOnExit
Returns True if we should delete testing dirs on exit. -
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
Sets up a new path in test filesystem to be used by tests.- Throws:
IOException
-
setupDataTestDirOnTestFS
Sets up a path in test filesystem to be used by tests. Creates a new directory if not already setup.- Throws:
IOException
-
getDataTestDirOnTestFS
Returns a Path in the test filesystem, obtained fromgetTestFileSystem()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
Returns a Path in the test filesystem, obtained fromgetTestFileSystem()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
-