Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ public static void setUpHelper() throws Exception {
// Set MultiWAL (with 2 default WAL files per RS)
conf1.set(WALFactory.WAL_PROVIDER, provider);
TEST_UTIL.startMiniCluster();
conf1 = TEST_UTIL.getConfiguration();
TEST_UTIL.startMiniMapReduceCluster();

if (useSecondCluster) {
conf2 = HBaseConfiguration.create(conf1);
Expand All @@ -322,9 +324,7 @@ public static void setUpHelper() throws Exception {
CommonFSUtils.setWALRootDir(TEST_UTIL2.getConfiguration(), p);
TEST_UTIL2.startMiniCluster();
}
conf1 = TEST_UTIL.getConfiguration();

TEST_UTIL.startMiniMapReduceCluster();
BACKUP_ROOT_DIR =
new Path(new Path(TEST_UTIL.getConfiguration().get("fs.defaultFS")), BACKUP_ROOT_DIR)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
Expand All @@ -46,7 +46,7 @@

import org.apache.hbase.thirdparty.com.google.common.collect.Sets;

@Category({ MasterTests.class, SmallTests.class })
@Category({ MasterTests.class, MediumTests.class })
public class TestBackupHFileCleaner {

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(SmallTests.class)
@Category(MediumTests.class)
public class TestBackupSmallTests extends TestBackupBase {

@ClassRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.BindException;
import java.net.DatagramSocket;
import java.net.InetAddress;
Expand Down Expand Up @@ -136,7 +135,6 @@
import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.ReflectionUtils;
import org.apache.hadoop.hbase.util.RetryCounter;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.wal.WAL;
Expand All @@ -152,7 +150,6 @@
import org.apache.hadoop.hdfs.server.namenode.EditLogFileOutputStream;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.hadoop.mapred.TaskLog;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
Expand Down Expand Up @@ -2295,6 +2292,9 @@ public HRegionServer getRSForFirstRegionInTable(TableName tableName)

/**
* Starts a <code>MiniMRCluster</code> with a default number of <code>TaskTracker</code>'s.
* MiniMRCluster caches hadoop.log.dir when first started. It is not possible to start multiple
* MiniMRCluster instances with different log dirs. MiniMRCluster is only to be used from when the
* test is run from a separate VM (i.e not in SmallTests)
* @throws IOException When starting the cluster fails.
*/
public MiniMRCluster startMiniMapReduceCluster() throws IOException {
Expand All @@ -2305,35 +2305,11 @@ public MiniMRCluster startMiniMapReduceCluster() throws IOException {
return mrCluster;
}

/**
* Tasktracker has a bug where changing the hadoop.log.dir system property will not change its
* internal static LOG_DIR variable.
*/
private void forceChangeTaskLogDir() {
Field logDirField;
try {
logDirField = TaskLog.class.getDeclaredField("LOG_DIR");
logDirField.setAccessible(true);

Field modifiersField = ReflectionUtils.getModifiersField();
modifiersField.setAccessible(true);
modifiersField.setInt(logDirField, logDirField.getModifiers() & ~Modifier.FINAL);

logDirField.set(null, new File(hadoopLogDir, "userlogs"));
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}

/**
* Starts a <code>MiniMRCluster</code>. Call {@link #setFileSystemURI(String)} to use a different
* filesystem.
* filesystem. MiniMRCluster caches hadoop.log.dir when first started. It is not possible to start
* multiple MiniMRCluster instances with different log dirs. MiniMRCluster is only to be used from
* when the test is run from a separate VM (i.e not in SmallTests)
* @param servers The number of <code>TaskTracker</code>'s to start.
* @throws IOException When starting the cluster fails.
*/
Expand All @@ -2345,8 +2321,6 @@ private void startMiniMapReduceCluster(final int servers) throws IOException {
setupClusterTestDir();
createDirsAndSetProperties();

forceChangeTaskLogDir();

//// hadoop2 specific settings
// Tests were failing because this process used 6GB of virtual memory and was getting killed.
// we up the VM usable so that processes don't get killed.
Expand Down