lokeshj1703 commented on a change in pull request #1318: HDDS-1753. Datanode
unable to find chunk while replication data using ratis.
URL: https://github.com/apache/hadoop/pull/1318#discussion_r316030192
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java
##########
@@ -236,14 +244,43 @@ public ContainerReportsProto getContainerReport() throws
IOException {
ContainerDeletionChoosingPolicy deletionPolicy)
throws StorageContainerException {
Map<Long, ContainerData> containerDataMap =
containerMap.entrySet().stream()
- .filter(e -> deletionPolicy.isValidContainerType(
- e.getValue().getContainerType()))
- .collect(Collectors.toMap(Map.Entry::getKey,
- e -> e.getValue().getContainerData()));
+ .filter(e ->
+
deletionPolicy.isValidContainerType(e.getValue().getContainerType())
+ && isDeletionAllowed(e.getValue().getContainerData())).collect(
+ Collectors.toMap(Map.Entry::getKey,
+ e -> e.getValue().getContainerData()));
return deletionPolicy
.chooseContainerForBlockDeletion(count, containerDataMap);
}
+ private boolean isDeletionAllowed(ContainerData containerData) {
+ if (containerData.isClosed()) {
+ if (writeChannel instanceof XceiverServerRatis) {
+ try {
+ XceiverServerRatis ratisServer = (XceiverServerRatis) writeChannel;
+ long minReplicatedIndex =
ratisServer.getMinReplicatedIndex(PipelineID
+ .valueOf(UUID.fromString(containerData.getOriginPipelineId())));
+ long containerBCSID = containerData.getBlockCommitSequenceId();
+ if (minReplicatedIndex != 0 && minReplicatedIndex < containerBCSID) {
+ LOG.info("Close Container lo Index {} is not replicated across all"
+ + "the servers in the pipeline {} as the min replicated "
+ + "index is {}. Deletion is not allowed in this container "
+ + "yet.", containerBCSID,
containerData.getOriginPipelineId(),
+ minReplicatedIndex);
+ return false;
+ } else {
+ return true;
+ }
+ } catch (IOException ioe) {
+ LOG.info(ioe.getMessage());
Review comment:
This should be LOG.error?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]