HDDS-48. Fix branch after merging from trunk.

This commit is contained in:
Bharat Viswanadham 2018-07-09 12:30:59 -07:00 committed by Arpit Agarwal
parent c275a9a6a0
commit 3584baf264
2 changed files with 19 additions and 17 deletions

View File

@ -34,9 +34,10 @@
import org.apache.hadoop.ozone.client.OzoneClientFactory;
import org.apache.hadoop.ozone.client.OzoneVolume;
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
import org.apache.hadoop.ozone.container.common.helpers.ContainerData;
import org.apache.hadoop.ozone.container.common.helpers.KeyUtils;
import org.apache.hadoop.ozone.container.common.impl.ContainerManagerImpl;
import org.apache.hadoop.ozone.container.common.impl.ContainerData;
import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
import org.apache.hadoop.ozone.container.keyvalue.helpers.KeyUtils;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
@ -46,6 +47,7 @@
import org.apache.hadoop.utils.MetadataStore;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
@ -56,10 +58,11 @@
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
@Ignore("Need to be fixed according to ContainerIO")
public class TestBlockDeletion {
private static OzoneConfiguration conf = null;
private static ObjectStore store;
private static ContainerManagerImpl dnContainerManager = null;
private static ContainerSet dnContainerManager = null;
private static StorageContainerManager scm = null;
private static OzoneManager om = null;
private static Set<Long> containerIdsWithDeletedBlocks;
@ -85,9 +88,8 @@ public static void init() throws Exception {
MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1).build();
cluster.waitForClusterToBeReady();
store = OzoneClientFactory.getRpcClient(conf).getObjectStore();
dnContainerManager =
(ContainerManagerImpl) cluster.getHddsDatanodes().get(0)
.getDatanodeStateMachine().getContainer().getContainerManager();
dnContainerManager = cluster.getHddsDatanodes().get(0)
.getDatanodeStateMachine().getContainer().getContainerSet();
om = cluster.getOzoneManager();
scm = cluster.getStorageContainerManager();
containerIdsWithDeletedBlocks = new HashSet<>();
@ -148,8 +150,8 @@ private void matchContainerTransactionIds() throws IOException {
Assert.assertEquals(
scm.getContainerInfo(containerId).getDeleteTransactionId(), 0);
}
Assert.assertEquals(dnContainerManager.readContainer(containerId)
.getDeleteTransactionId(),
Assert.assertEquals(dnContainerManager.getContainer(containerId)
.getContainerData().getDeleteTransactionId(),
scm.getContainerInfo(containerId).getDeleteTransactionId());
}
}
@ -159,9 +161,9 @@ private boolean verifyBlocksCreated(
throws IOException {
return performOperationOnKeyContainers((blockID) -> {
try {
MetadataStore db = KeyUtils.getDB(
dnContainerManager.getContainerMap().get(blockID.getContainerID()),
conf);
MetadataStore db = KeyUtils.getDB((KeyValueContainerData)
dnContainerManager.getContainer(blockID.getContainerID())
.getContainerData(), conf);
Assert.assertNotNull(db.get(Longs.toByteArray(blockID.getLocalID())));
} catch (IOException e) {
e.printStackTrace();
@ -174,9 +176,9 @@ private boolean verifyBlocksDeleted(
throws IOException {
return performOperationOnKeyContainers((blockID) -> {
try {
MetadataStore db = KeyUtils.getDB(
dnContainerManager.getContainerMap().get(blockID.getContainerID()),
conf);
MetadataStore db = KeyUtils.getDB((KeyValueContainerData)
dnContainerManager.getContainer(blockID.getContainerID())
.getContainerData(), conf);
Assert.assertNull(db.get(Longs.toByteArray(blockID.getLocalID())));
Assert.assertNull(db.get(DFSUtil.string2Bytes(
OzoneConsts.DELETING_KEY_PREFIX + blockID.getLocalID())));

View File

@ -338,8 +338,8 @@ public void testInfoContainer() throws Exception {
openStatus = data.isOpen() ? "OPEN" : "CLOSED";
expected = String
.format(formatStr, container.getContainerID(), openStatus,
data.getDbFile().getPath(), data.getContainerPath(), "",
.format(formatStr, container.getContainerInfo().getContainerID(),
openStatus, data.getDbFile().getPath(), data.getContainerPath(), "",
datanodeDetails.getHostName(), datanodeDetails.getHostName());
assertEquals(expected, out.toString());
}