HDFS-13026. Ozone: TestContainerPersistence is failing becaue of container data mismatch. Contributed by Mukul Kumar Singh.

This commit is contained in:
Anu Engineer 2018-01-18 09:51:27 -08:00 committed by Owen O'Malley
parent 28b87af51b
commit 916f31f7d1
2 changed files with 9 additions and 4 deletions

View File

@ -98,8 +98,13 @@ public class ChunkManagerImpl implements ChunkManager {
commitChunk(tmpChunkFile, chunkFile, containerName, info.getLen());
break;
case COMBINED:
ChunkUtils.writeData(tmpChunkFile, info, data);
commitChunk(tmpChunkFile, chunkFile, containerName, info.getLen());
// directly write to the chunk file
long oldSize = chunkFile.length();
ChunkUtils.writeData(chunkFile, info, data);
long newSize = chunkFile.length();
containerManager.incrBytesUsed(containerName, newSize - oldSize);
containerManager.incrWriteCount(containerName);
containerManager.incrWriteBytes(containerName, info.getLen());
break;
}
} catch (ExecutionException | NoSuchAlgorithmException | IOException e) {

View File

@ -531,8 +531,8 @@ public class TestContainerPersistence {
try {
chunkManager.writeChunk(pipeline, keyName, info, data, COMBINED);
} catch (IOException ex) {
Assert.assertTrue(ex.getMessage().contains(
"Rejecting write chunk request. OverWrite flag required."));
Assert.assertTrue(ex.getCause().getMessage().contains(
"Rejecting write chunk request. OverWrite flag required"));
}
// With the overwrite flag it should work now.