Skip to content

Conversation

@Tejaskriya
Copy link
Contributor

What changes were proposed in this pull request?

If any of the container scanners (background or on-demand, data or metadata) find an unhealthy container, they should trigger an on-demand volume scan to check if the underlying volume has a larger issue beyond that container.

This PR triggers a volume check for when a container is marked unhealthy by the scanners

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13092

How was this patch tested?

Added unit test coverage

@Tejaskriya Tejaskriya added the scanners Changes related to datanode container and volume scanners label Jun 11, 2025
@Tejaskriya Tejaskriya marked this pull request as ready for review June 11, 2025 07:14
@Tejaskriya
Copy link
Contributor Author

@ptlrs Could you please review this PR?

@adoroszlai
Copy link
Contributor

nit: any scan "triggered" by some event is by definition an "on-demand" scan (vs. background scan, which runs on schedule). So can we omit "on-demand" from the title?

@Tejaskriya
Copy link
Contributor Author

@adoroszlai makes sense, I'll change the title. Thanks!

@Tejaskriya Tejaskriya changed the title HDDS-13092. Container scanner should trigger on-demand volume scan when marking a container unhealthy HDDS-13092. Container scanner should trigger volume scan when marking a container unhealthy Jun 11, 2025
Copy link
Contributor

@aryangupta1998 aryangupta1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @Tejaskriya.
IIUC, containers of a volume are scanned in a single iteration. If a volume has multiple unhealthy containers, we may end up triggering a volume scan multiple times for the same volume using:
StorageVolumeUtil.onFailure(containerData.getVolume());
To avoid redundant volume scans, we can track which volumes have already been scanned in the current iteration. One way is to pass a Set to scanContainer():

public void scanContainer(Container<?> c, Set<Path> volumesAlreadyChecked)

Then, within scanContainer(), only trigger the volume scan if it hasn't already been triggered:

Path volumePath = containerData.getVolume().getStorageDir().getPath();
if (volumesAlreadyChecked.add(volumePath)) {
    LOG.info("Triggering a volume scan for volume [{}] as unhealthy container [{}] was on it.",
        volumePath, containerId);
    StorageVolumeUtil.onFailure(containerData.getVolume());
}

@Tejaskriya
Copy link
Contributor Author

@aryangupta1998 in the scheduling logic, we have throttling. In org.apache.hadoop.ozone.container.common.volume.ThrottledAsyncChecker#schedule, if a request for multiple scans of the same volume comes within a timeframe, then it is skipped.
This durations seems to be defaulting to 10m:
@Config(key = "disk.check.min.gap", defaultValue = "10m",

@adoroszlai adoroszlai marked this pull request as draft June 20, 2025 10:17
@adoroszlai adoroszlai marked this pull request as ready for review June 20, 2025 11:50
@Tejaskriya Tejaskriya marked this pull request as draft July 8, 2025 05:11
@Tejaskriya Tejaskriya marked this pull request as ready for review July 8, 2025 05:45
@Tejaskriya
Copy link
Contributor Author

@ptlrs requesting a review for this PR

Copy link
Contributor

@ptlrs ptlrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Tejaskriya for the PR, it mostly looks good.

@Tejaskriya
Copy link
Contributor Author

Thanks for the review and approval @ptlrs . I have made the changes.
@aryangupta1998 could you please review and approve the PR if it seems good?

Copy link
Contributor

@aryangupta1998 aryangupta1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Tejaskriya
Copy link
Contributor Author

@ptlrs @errose28 @aryangupta1998 could you please review the patch again?

Copy link
Contributor

@aryangupta1998 aryangupta1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the patch @Tejaskriya, LGTM!

Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment here and in this thread then I think this is good to go.

Copy link
Contributor

@ptlrs ptlrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @Tejaskriya.

Copy link
Contributor

@errose28 errose28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @Tejaskriya

@errose28 errose28 merged commit 498a9c1 into apache:master Jul 21, 2025
81 of 82 checks passed
@adoroszlai
Copy link
Contributor

Please feel free remove co-author information when the only contribution is merging master into the PR branch.

errose28 added a commit to errose28/ozone that referenced this pull request Jul 30, 2025
* master: (730 commits)
  HDDS-13083. Handle cases where block deletion generates tree file before scanner (apache#8565)
  HDDS-12982. Reduce log level for snapshot validation failure (apache#8851)
  HDDS-13396. Documentation: Improve the top-level overview page for new users. (apache#8753)
  HDDS-13176. containerIds table value format change to proto from string (apache#8589)
  HDDS-13449. Incorrect Interrupt Handling for DirectoryDeletingService and KeyDeletingService (apache#8817)
  HDDS-2453. Add Freon tests for S3 MPU Keys (apache#8803)
  HDDS-13237. Container data checksum should contain block IDs. (apache#8773)
  HDDS-13489. Fix SCMBlockdeleting unnecessary iteration in corner case. (apache#8847)
  HDDS-13464. Make ozone.snapshot.filtering.service.interval reconfigurable (apache#8825)
  HDDS-13473. Amend validation for OZONE_OM_SNAPSHOT_DB_MAX_OPEN_FILES (apache#8829)
  HDDS-13435. Add an OzoneManagerAuthorizer interface (apache#8840)
  HDDS-8565. Recon memory leak in NSSummary (apache#8823).
  HDDS-12852. Implement a sliding window counter utility (apache#8498)
  HDDS-12000. Add unit test for RatisContainerSafeModeRule and ECContainerSafeModeRule (apache#8801)
  HDDS-13092. Container scanner should trigger volume scan when marking a container unhealthy (apache#8603)
  HDDS-13070. OM Follower changes to create and place sst files from hardlink file. (apache#8761)
  HDDS-13482. Mark testWriteStateMachineDataIdempotencyWithClosedContainer as flaky
  HDDS-13481. Fix success latency metric in SCM panels of deletion grafana dashboard (apache#8835)
  HDDS-13468. Update default value of ozone.scm.ha.dbtransactionbuffer.flush.interval. (apache#8834)
  HDDS-13410. Control block deletion for each DN from SCM. (apache#8767)
  ...

hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReplicaInfo.java
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/container/ReconcileSubcommand.java
hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/hdds/scm/cli/container/TestReconcileSubcommand.java
jojochuang pushed a commit to jojochuang/ozone that referenced this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scanners Changes related to datanode container and volume scanners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants