Gargi-jais11 commented on code in PR #8693:
URL: https://github.com/apache/ozone/pull/8693#discussion_r2230156775
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -468,15 +471,36 @@ public BackgroundTaskResult call() {
boolean destVolumeIncreased = false;
Path diskBalancerTmpDir = null, diskBalancerDestDir = null;
long containerSize = containerData.getBytesUsed();
+ String originalContainerChecksum =
containerData.getContainerFileChecksum();
try {
+ // Step 1: Copy container to new Volume's tmp Dir
diskBalancerTmpDir = destVolume.getTmpDir().toPath()
.resolve(DISK_BALANCER_DIR).resolve(String.valueOf(containerId));
-
- // Copy container to new Volume's tmp Dir
ozoneContainer.getController().copyContainer(containerData,
diskBalancerTmpDir);
- // Move container directory to final place on new volume
+ // Step 2: verify checksum and Transition Temp container to Temp
C1-RECOVERING
+ File tempContainerFile = ContainerUtils.getContainerFile(
+ diskBalancerTmpDir.toFile());
+ if (!tempContainerFile.exists()) {
+ throw new IOException("ContainerFile for container " + containerId
+ + " doesn't exist in temp directory "
+ + tempContainerFile.getAbsolutePath());
+ }
+ ContainerData tempContainerData = ContainerDataYaml
+ .readContainerFile(tempContainerFile);
+ String copiedContainerChecksum =
tempContainerData.getContainerFileChecksum();
+ if (!originalContainerChecksum.equals(copiedContainerChecksum)) {
+ throw new IOException("Container checksum mismatch for container "
Review Comment:
When IO Exception is thrown then **temp container** will be deleted in the
**catch** block below. So I don't think it is needed to do it here explicity.
https://github.com/apache/ozone/blob/7ccece514e6fe2a7080ed8fecf83c59fc1c721fd/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java#L572-L585
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]