Wei-Chiu Chuang created HDDS-15009:
--------------------------------------
Summary: [Docs] Administrator guide: Ozone Container Scanner
Key: HDDS-15009
URL: https://issues.apache.org/jira/browse/HDDS-15009
Project: Apache Ozone
Issue Type: Task
Components: documentation
Reporter: Wei-Chiu Chuang
✦ Ozone Container Scanner: Administrator's Guide
The Container Scanner is a critical background service running on Ozone
Datanodes that ensures data integrity by proactively detecting "bit rot" or
silent
data corruption. This guide explains how it works, how it handles errors, and
how to tune it for your cluster.
1. Overview
Storage media can occasionally suffer from silent corruption where data
becomes unreadable or modified without throwing an immediate I/O error. The
Container Scanner periodically verifies all containers stored on a Datanode
to identify such issues before the data is requested by a client.
Why it is useful:
* Proactive Detection: It identifies corrupt replicas early, allowing Ozone
to recover data from healthy replicas while they are still available.
* Data Reliability: By ensuring that all replicas are healthy, it maintains
the desired replication factor and prevents data loss.
* Automated Recovery: It integrates with the Storage Container Manager (SCM)
to trigger automatic replication of corrupt containers.
---
2. Scanner Types
The system employs three specialized scanners to balance thoroughness with
system performance:
* Background Metadata Scanner: A lightweight scanner that verifies the
integrity of container metadata and the internal database. It runs in a single
thread across all volumes on a Datanode.
* Background Data Scanner: A more intensive scanner that reads all data
within a container and verifies it against stored checksums. To minimize
performance impact, it runs one thread per volume and is heavily throttled.
* On-Demand Scanner: Triggered automatically when a container is first
opened or if a potential corruption is suspected during normal read/write
operations.
---
3. Error Handling Workflow
When the scanner detects corruption in a container, the following sequence
occurs:
1. Marked UNHEALTHY: The Datanode immediately marks the container as
UNHEALTHY in its local state.
2. SCM Notification: The next heartbeat to the Storage Container Manager
(SCM) reports this unhealthy state.
3. Automatic Replication: SCM identifies that the container has fewer
healthy replicas than required and coordinates with other Datanodes to
replicate a
healthy copy of the container.
4. Volume Health Check: Detecting a corrupt container may indicate a failing
disk. The Datanode automatically triggers a Volume Scan on the underlying
disk to determine if the entire volume should be marked as failed.
---
4. Volume Scanner
The Volume Scanner (implemented via StorageVolumeChecker) is a separate but
related mechanism. While the Container Scanner checks data integrity, the
Volume Scanner checks disk health.
* Trigger: It runs periodically or is triggered immediately when a container
scan fails.
* Mechanism: It performs basic filesystem operations (like reading/writing a
test file) on the volume.
* Outcome: If the Volume Scanner determines the disk is dead or unreliable,
the Datanode will mark the entire volume as FAILED. SCM will then work to
evacuate or re-replicate all containers that were stored on that disk.
---
5. Configuration and Tuning
Administrators can tune the scanners using the following parameters in
ozone-site.xml. All keys are prefixed with hdds.container.scrub..
┌───────────────────────────────────┬─────────┬───────────────────────────────────────────────────────────────────────────────────────────────┐
│ Configuration Key │ Default │ Description
│
├───────────────────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
│ enabled │ true │ Main switch to enable or
disable all container scanners. │
│ metadata.scan.interval │ 3h │ Time interval between two
successive metadata scans. │
│ data.scan.interval │ 7d │ Minimum interval between two
iterations of full data scanning. If a scan completes faster, it │
│ │ │ waits for the remaining time.
│
│ volume.bytes.per.second │ 5242880 │ I/O bandwidth limit per
volume for the background data scanner. │
│ │ (5MB/s) │
│
│ on.demand.volume.bytes.per.second │ 5242880 │ I/O bandwidth limit per
volume for the on-demand scanner. │
│ │ (5MB/s) │
│
│ min.gap │ 15m │ The minimum time that must
pass before the same container can be scanned again. │
└───────────────────────────────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────┘
Tuning Tips:
* For Large Clusters: If you have high-density nodes (many TBs per disk),
you may need to increase the volume.bytes.per.second if the 7-day interval is
not enough to cover all data.
* I/O Sensitive Workloads: If background scanning impacts your application
performance, decrease the volume.bytes.per.second bandwidth.
* Developer Testing: Use dev.data.scan.enabled or dev.metadata.scan.enabled
(both true by default) to toggle specific background scan components during
troubleshooting.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]