|
@@ -21,17 +21,16 @@ import com.google.common.collect.Lists;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.hdds.client.BlockID;
|
|
import org.apache.hadoop.hdds.client.BlockID;
|
|
-import org.apache.hadoop.hdds.scm.TestUtils;
|
|
|
|
import org.apache.hadoop.hdfs.DFSUtil;
|
|
import org.apache.hadoop.hdfs.DFSUtil;
|
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
|
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
|
|
-import org.apache.hadoop.hdfs.server.datanode.StorageLocation;
|
|
|
|
-import org.apache.hadoop.ozone.OzoneConfigKeys;
|
|
|
|
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
|
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
|
import org.apache.hadoop.ozone.OzoneConsts;
|
|
import org.apache.hadoop.ozone.OzoneConsts;
|
|
import org.apache.hadoop.ozone.container.ContainerTestHelper;
|
|
import org.apache.hadoop.ozone.container.ContainerTestHelper;
|
|
import org.apache.hadoop.ozone.container.common.impl.ContainerData;
|
|
import org.apache.hadoop.ozone.container.common.impl.ContainerData;
|
|
import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
|
|
import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
|
|
import org.apache.hadoop.ozone.container.common.interfaces.Container;
|
|
import org.apache.hadoop.ozone.container.common.interfaces.Container;
|
|
|
|
+import org.apache.hadoop.ozone.container.common.volume.RoundRobinVolumeChoosingPolicy;
|
|
|
|
+import org.apache.hadoop.ozone.container.common.volume.VolumeSet;
|
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
|
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
|
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
|
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
|
|
import org.apache.hadoop.ozone.container.keyvalue.helpers.KeyUtils;
|
|
import org.apache.hadoop.ozone.container.keyvalue.helpers.KeyUtils;
|
|
@@ -47,7 +46,6 @@ import org.apache.hadoop.utils.BackgroundService;
|
|
import org.apache.hadoop.utils.MetadataKeyFilters;
|
|
import org.apache.hadoop.utils.MetadataKeyFilters;
|
|
import org.apache.hadoop.utils.MetadataStore;
|
|
import org.apache.hadoop.utils.MetadataStore;
|
|
import org.junit.Assert;
|
|
import org.junit.Assert;
|
|
-import org.junit.Ignore;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.BeforeClass;
|
|
import org.junit.BeforeClass;
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
@@ -58,9 +56,9 @@ import org.slf4j.LoggerFactory;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.Charset;
|
|
-import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.UUID;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeoutException;
|
|
import java.util.concurrent.TimeoutException;
|
|
|
|
|
|
@@ -75,7 +73,6 @@ import static org.apache.hadoop.ozone.OzoneConfigKeys
|
|
* Tests to test block deleting service.
|
|
* Tests to test block deleting service.
|
|
*/
|
|
*/
|
|
// TODO: Fix BlockDeletingService to work with new StorageLayer
|
|
// TODO: Fix BlockDeletingService to work with new StorageLayer
|
|
-@Ignore
|
|
|
|
public class TestBlockDeletingService {
|
|
public class TestBlockDeletingService {
|
|
|
|
|
|
private static final Logger LOG =
|
|
private static final Logger LOG =
|
|
@@ -120,6 +117,8 @@ public class TestBlockDeletingService {
|
|
KeyValueContainerData data = new KeyValueContainerData(containerID,
|
|
KeyValueContainerData data = new KeyValueContainerData(containerID,
|
|
ContainerTestHelper.CONTAINER_MAX_SIZE_GB);
|
|
ContainerTestHelper.CONTAINER_MAX_SIZE_GB);
|
|
Container container = new KeyValueContainer(data, conf);
|
|
Container container = new KeyValueContainer(data, conf);
|
|
|
|
+ container.create(new VolumeSet(UUID.randomUUID().toString(), conf),
|
|
|
|
+ new RoundRobinVolumeChoosingPolicy(), UUID.randomUUID().toString());
|
|
containerSet.addContainer(container);
|
|
containerSet.addContainer(container);
|
|
data = (KeyValueContainerData) containerSet.getContainer(
|
|
data = (KeyValueContainerData) containerSet.getContainer(
|
|
containerID).getContainerData();
|
|
containerID).getContainerData();
|
|
@@ -188,6 +187,9 @@ public class TestBlockDeletingService {
|
|
@Test
|
|
@Test
|
|
public void testBlockDeletion() throws Exception {
|
|
public void testBlockDeletion() throws Exception {
|
|
Configuration conf = new OzoneConfiguration();
|
|
Configuration conf = new OzoneConfiguration();
|
|
|
|
+ conf.set(
|
|
|
|
+ ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
|
|
|
|
+ RandomContainerDeletionChoosingPolicy.class.getName());
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
ContainerSet containerSet = new ContainerSet();
|
|
ContainerSet containerSet = new ContainerSet();
|
|
@@ -236,6 +238,9 @@ public class TestBlockDeletingService {
|
|
@Test
|
|
@Test
|
|
public void testShutdownService() throws Exception {
|
|
public void testShutdownService() throws Exception {
|
|
Configuration conf = new OzoneConfiguration();
|
|
Configuration conf = new OzoneConfiguration();
|
|
|
|
+ conf.set(
|
|
|
|
+ ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
|
|
|
|
+ RandomContainerDeletionChoosingPolicy.class.getName());
|
|
conf.setTimeDuration(OZONE_BLOCK_DELETING_SERVICE_INTERVAL, 500,
|
|
conf.setTimeDuration(OZONE_BLOCK_DELETING_SERVICE_INTERVAL, 500,
|
|
TimeUnit.MILLISECONDS);
|
|
TimeUnit.MILLISECONDS);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
@@ -264,6 +269,9 @@ public class TestBlockDeletingService {
|
|
@Test
|
|
@Test
|
|
public void testBlockDeletionTimeout() throws Exception {
|
|
public void testBlockDeletionTimeout() throws Exception {
|
|
Configuration conf = new OzoneConfiguration();
|
|
Configuration conf = new OzoneConfiguration();
|
|
|
|
+ conf.set(
|
|
|
|
+ ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
|
|
|
|
+ RandomContainerDeletionChoosingPolicy.class.getName());
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
ContainerSet containerSet = new ContainerSet();
|
|
ContainerSet containerSet = new ContainerSet();
|
|
@@ -333,6 +341,9 @@ public class TestBlockDeletingService {
|
|
// 1 block from 1 container can be deleted.
|
|
// 1 block from 1 container can be deleted.
|
|
Configuration conf = new OzoneConfiguration();
|
|
Configuration conf = new OzoneConfiguration();
|
|
// Process 1 container per interval
|
|
// Process 1 container per interval
|
|
|
|
+ conf.set(
|
|
|
|
+ ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
|
|
|
|
+ RandomContainerDeletionChoosingPolicy.class.getName());
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 1);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 1);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 1);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 1);
|
|
ContainerSet containerSet = new ContainerSet();
|
|
ContainerSet containerSet = new ContainerSet();
|
|
@@ -366,6 +377,9 @@ public class TestBlockDeletingService {
|
|
// per container can be actually deleted. So it requires 2 waves
|
|
// per container can be actually deleted. So it requires 2 waves
|
|
// to cleanup all blocks.
|
|
// to cleanup all blocks.
|
|
Configuration conf = new OzoneConfiguration();
|
|
Configuration conf = new OzoneConfiguration();
|
|
|
|
+ conf.set(
|
|
|
|
+ ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
|
|
|
|
+ RandomContainerDeletionChoosingPolicy.class.getName());
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
conf.setInt(OZONE_BLOCK_DELETING_LIMIT_PER_CONTAINER, 2);
|
|
ContainerSet containerSet = new ContainerSet();
|
|
ContainerSet containerSet = new ContainerSet();
|