[ 
https://issues.apache.org/jira/browse/HDDS-15319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082095#comment-18082095
 ] 

Priyesh K commented on HDDS-15319:
----------------------------------

STORAGE_SPACE_DISTRIBUTION should be finalized to see data in scm for pending 
deletion.  You can refer following code for the logic.

{code:java}
private DeletedBlocksTransaction constructNewTransaction(
    long txID, long containerID, List<DeletedBlock> blocks) {
  List<Long> localIdList = blocks.stream().map(b -> 
b.getBlockID().getLocalID()).collect(Collectors.toList());
  DeletedBlocksTransaction.Builder builder = 
DeletedBlocksTransaction.newBuilder()
      .setTxID(txID)
      .setContainerID(containerID)
      .addAllLocalID(localIdList)
      .setCount(0);

  if 
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION))
 {
    long replicatedSize = 
blocks.stream().mapToLong(DeletedBlock::getReplicatedSize).sum();
    // even when HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION is finalized, old 
OM can still call the old API
    if (replicatedSize >= 0) {
      builder.setTotalBlockReplicatedSize(replicatedSize);
      
builder.setTotalBlockSize(blocks.stream().mapToLong(DeletedBlock::getSize).sum());
    }

    long sizePerReplica = 
blocks.stream().mapToLong(DeletedBlock::getSizePerReplica).sum();
    if (sizePerReplica >= 0) {
      builder.setTotalSizePerReplica(sizePerReplica);
    }
  }
  return builder.build();
} {code}
So closing this ticket as information provided.

> [Recon] SCM Pending Deletion to be updated in case of deletion when DNs are 
> down
> --------------------------------------------------------------------------------
>
>                 Key: HDDS-15319
>                 URL: https://issues.apache.org/jira/browse/HDDS-15319
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Pruthvi Tantri
>            Assignee: Priyesh K
>            Priority: Major
>
> Issue:
>  * When Deletions are triggered and DNs are down the deletions are saved in 
> SCM until DNs come up.
>  * This should be reflected in Pending Deletions of SCM in Cluster Capacity 
> as well



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to