use of org.apache.hadoop.ozone.container.metadata.DatanodeStoreSchemaTwoImpl in project ozone by apache.
the class TestBlockDeletingService method createTxn.
private void createTxn(KeyValueContainerData data, List<Long> containerBlocks, int txnID, long containerID) {
try (ReferenceCountedDB metadata = BlockUtils.getDB(data, conf)) {
StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction dtx = StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction.newBuilder().setTxID(txnID).setContainerID(containerID).addAllLocalID(containerBlocks).setCount(0).build();
try (BatchOperation batch = metadata.getStore().getBatchHandler().initBatchOperation()) {
DatanodeStore ds = metadata.getStore();
DatanodeStoreSchemaTwoImpl dnStoreTwoImpl = (DatanodeStoreSchemaTwoImpl) ds;
dnStoreTwoImpl.getDeleteTransactionTable().putWithBatch(batch, (long) txnID, dtx);
metadata.getStore().getBatchHandler().commitBatchOperation(batch);
}
} catch (IOException exception) {
LOG.warn("Transaction creation was not successful for txnID: " + txnID + " consisting of " + containerBlocks.size() + " blocks.");
}
}
Aggregations