Skip to content

HDDS-15456. Add SCM DB lookup and identify orphan(wrt SCM) and deleted-but-present containers#10547

Open
sreejasahithi wants to merge 2 commits into
apache:masterfrom
sreejasahithi:HDDS-15456
Open

HDDS-15456. Add SCM DB lookup and identify orphan(wrt SCM) and deleted-but-present containers#10547
sreejasahithi wants to merge 2 commits into
apache:masterfrom
sreejasahithi:HDDS-15456

Conversation

@sreejasahithi

@sreejasahithi sreejasahithi commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR extends ozone debug datanode container analyze with optional SCM metadata lookup via --scm-db option.

When a scm.db path is provided, the command classifies each container ID found during the on-disk DataNode scan HDDS-15455 against SCM metadata and reports:

  • Orphan containers (wrt SCM): present on disk but not in SCM
  • Deleted but present containers: present on disk but marked DELETED in SCM

Containers in SCM with any other lifecycle state are skipped. Without --scm-db, the command prints a hint that SCM lookup is required for orphan and deleted-but-present detection and displays only the duplicate container information.

What is the link to the Apache JIRA

HDDS-15456

How was this patch tested?

Tested in docker cluster by manually creating the inconsistencies
Sample outputs:

bash-5.1$ ozone debug datanode container analyze --scm-db /tmp/scm-offline
Number of orphan containers(wrt SCM) on this DataNode: 2
Container 21 (2 occurrences):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=VALID size=82486 bytes

 path=/data/hdds4/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=MISSING_METADATA size=81920 bytes

Container 22 (1 occurrence):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/22
 status=VALID size=82486 bytes

Number of deleted but present containers on this DataNode: 0
Number of containers with duplicate container directories on this DataNode: 2
Container 10 (2 occurrences):
 path=/data/hdds2/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/10
 status=VALID size=62223 bytes

 path=/data/hdds3/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/10
 status=VALID size=62223 bytes

Container 21 (2 occurrences):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=VALID size=82486 bytes

 path=/data/hdds4/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=MISSING_METADATA size=81920 bytes

bash-5.1$
bash-5.1$ ozone debug datanode container analyze --scm-db /tmp/scm-offline-deleted
Number of orphan containers(wrt SCM) on this DataNode: 2
Container 21 (2 occurrences):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=VALID size=82486 bytes

 path=/data/hdds4/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=MISSING_METADATA size=81920 bytes

Container 22 (1 occurrence):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/22
 status=VALID size=82486 bytes

Number of deleted but present containers on this DataNode: 2
Container 5 (1 occurrence):
 path=/data/hdds2/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/5
 status=VALID size=72493 bytes

Container 10 (1 occurrence):
 path=/data/hdds2/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/10
 status=VALID size=62223 bytes

Number of containers with duplicate container directories on this DataNode: 1
Container 21 (2 occurrences):
 path=/data/hdds0/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=VALID size=82486 bytes

 path=/data/hdds4/hdds/CID-cdb372ce-9eb0-4738-adb6-99882aa95a56/current/containerDir0/21
 status=MISSING_METADATA size=81920 bytes

bash-5.1$

@sreejasahithi sreejasahithi marked this pull request as ready for review June 19, 2026 09:35
@sreejasahithi

Copy link
Copy Markdown
Contributor Author

@devmadhuu could you please review this PR.

@errose28

Copy link
Copy Markdown
Contributor

cc @rnblough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants