|
@@ -162,6 +162,9 @@ public class TestContainerPersistence {
|
|
|
|
|
|
private Container addContainer(ContainerSet cSet, long cID)
|
|
private Container addContainer(ContainerSet cSet, long cID)
|
|
throws IOException {
|
|
throws IOException {
|
|
|
|
+ long commitBytesBefore = 0;
|
|
|
|
+ long commitBytesAfter = 0;
|
|
|
|
+ long commitIncrement = 0;
|
|
KeyValueContainerData data = new KeyValueContainerData(cID,
|
|
KeyValueContainerData data = new KeyValueContainerData(cID,
|
|
ContainerTestHelper.CONTAINER_MAX_SIZE, UUID.randomUUID().toString(),
|
|
ContainerTestHelper.CONTAINER_MAX_SIZE, UUID.randomUUID().toString(),
|
|
UUID.randomUUID().toString());
|
|
UUID.randomUUID().toString());
|
|
@@ -169,7 +172,15 @@ public class TestContainerPersistence {
|
|
data.addMetadata("owner)", "bilbo");
|
|
data.addMetadata("owner)", "bilbo");
|
|
KeyValueContainer container = new KeyValueContainer(data, conf);
|
|
KeyValueContainer container = new KeyValueContainer(data, conf);
|
|
container.create(volumeSet, volumeChoosingPolicy, SCM_ID);
|
|
container.create(volumeSet, volumeChoosingPolicy, SCM_ID);
|
|
|
|
+ commitBytesBefore = container.getContainerData()
|
|
|
|
+ .getVolume().getCommittedBytes();
|
|
cSet.addContainer(container);
|
|
cSet.addContainer(container);
|
|
|
|
+ commitBytesAfter = container.getContainerData()
|
|
|
|
+ .getVolume().getCommittedBytes();
|
|
|
|
+ commitIncrement = commitBytesAfter - commitBytesBefore;
|
|
|
|
+ // did we commit space for the new container?
|
|
|
|
+ Assert.assertTrue(commitIncrement ==
|
|
|
|
+ ContainerTestHelper.CONTAINER_MAX_SIZE);
|
|
return container;
|
|
return container;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -328,6 +339,9 @@ public class TestContainerPersistence {
|
|
|
|
|
|
private ChunkInfo writeChunkHelper(BlockID blockID) throws IOException {
|
|
private ChunkInfo writeChunkHelper(BlockID blockID) throws IOException {
|
|
final int datalen = 1024;
|
|
final int datalen = 1024;
|
|
|
|
+ long commitBytesBefore = 0;
|
|
|
|
+ long commitBytesAfter = 0;
|
|
|
|
+ long commitDecrement = 0;
|
|
long testContainerID = blockID.getContainerID();
|
|
long testContainerID = blockID.getContainerID();
|
|
Container container = containerSet.getContainer(testContainerID);
|
|
Container container = containerSet.getContainer(testContainerID);
|
|
if (container == null) {
|
|
if (container == null) {
|
|
@@ -337,8 +351,15 @@ public class TestContainerPersistence {
|
|
blockID.getLocalID(), 0, 0, datalen);
|
|
blockID.getLocalID(), 0, 0, datalen);
|
|
byte[] data = getData(datalen);
|
|
byte[] data = getData(datalen);
|
|
setDataChecksum(info, data);
|
|
setDataChecksum(info, data);
|
|
|
|
+ commitBytesBefore = container.getContainerData()
|
|
|
|
+ .getVolume().getCommittedBytes();
|
|
chunkManager.writeChunk(container, blockID, info, ByteBuffer.wrap(data),
|
|
chunkManager.writeChunk(container, blockID, info, ByteBuffer.wrap(data),
|
|
getDispatcherContext());
|
|
getDispatcherContext());
|
|
|
|
+ commitBytesAfter = container.getContainerData()
|
|
|
|
+ .getVolume().getCommittedBytes();
|
|
|
|
+ commitDecrement = commitBytesBefore - commitBytesAfter;
|
|
|
|
+ // did we decrement commit bytes by the amount of data we wrote?
|
|
|
|
+ Assert.assertTrue(commitDecrement == info.getLen());
|
|
return info;
|
|
return info;
|
|
|
|
|
|
}
|
|
}
|