HDDS-1602. Fix TestContainerPersistence#testDeleteBlockTwice. (#858)

This commit is contained in:
Bharat Viswanadham 2019-05-28 11:27:16 -07:00 committed by GitHub
parent d1ec1c52e5
commit d8b18e82f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -229,12 +229,13 @@ public void deleteBlock(Container container, BlockID blockID) throws
// to delete a Block which might have just gotten inserted after
// the get check.
byte[] kKey = Longs.toByteArray(blockID.getLocalID());
try {
db.getStore().delete(kKey);
} catch (IOException e) {
byte[] kData = db.getStore().get(kKey);
if (kData == null) {
throw new StorageContainerException("Unable to find the block.",
NO_SUCH_BLOCK);
}
db.getStore().delete(kKey);
// Decrement blockcount here
container.getContainerData().decrKeyCount();
}