Skip to content

DAOS-17321 ddb: Add checksum check function to ddb vos API - #18941

Open
knard38 wants to merge 1 commit into
masterfrom
ckochhof/dev/master/daos-17321/patch-006
Open

DAOS-17321 ddb: Add checksum check function to ddb vos API#18941
knard38 wants to merge 1 commit into
masterfrom
ckochhof/dev/master/daos-17321/patch-006

Conversation

@knard38

@knard38 knard38 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This patch is part of a 3-way split of #18940 ("DAOS-17321 ddb: add csum_check command to verify data checksums"), which was too large to review as a single PR. The split mirrors the layering already used for the sibling csum_dump feature earlier in this same ticket (#18444 -> #18543 -> #18685):

  1. This patch — adds dv_check_csum() to the ddb VOS API (ddb_vos.c/ddb_vos.h), with unit tests.
  2. patch-007 (stacked on this one) — wires ddb_run_csum_check() into the ddb C command set on top of dv_check_csum(). More details could be found in the draft PR DAOS-17321 ddb: Add checksum check command to ddb C API #18942.
  3. patch-008 (stacked on patch-007) — wires csum_check through to the ddb Go CLI, plus documentation. More details could be found in the draft PR DAOS-17321 ddb: Add checksum check command to ddb GO code #18943.

Supersedes #18940, which contained all three layers as a single squashed commit.

Changes

dv_check_csum() — new ddb VOS API function (ddb_vos.c, ddb_vos.h)

dv_check_csum(daos_handle_t poh, struct dv_tree_path *path, daos_epoch_t epoch, dv_check_csum_cb check_cb, void *cb_arg) mirrors the structure of the existing dv_dump_csum() (open container, build the iod from path, dispatch by value type, close container), but additionally fetches the live data for each checksummed segment, recomputes its checksum(s) with a throwaway daos_csummer, and compares the result against what was already fetched from disk. Nothing is modified — this is a read-only verification pass.

Results are reported through a callback:

typedef int (*dv_check_csum_cb)(void *cb_arg, struct daos_recx_ep_list *recx_rel,
                                daos_epoch_t sv_epoch, struct dcs_ci_list *cil,
                                struct dcs_csum_info **got_csums);

got_csums is an array of cil->dcl_csum_infos_nr pointers: got_csums[i] holds the checksum recomputed from the currently stored data when entry i's stored checksum did not match, and is NULL when it matched (or there was nothing to check) — so got_csums[i] != NULL doubles as the per-entry mismatch flag. The function itself returns -DER_CSUM if any entry failed to match, after invoking the callback with the full picture (so callers can report every mismatch, not just the first one).

Internally, check_csum_sv()/check_csum_recx() fetch the checksum metadata via the same VOS_OF_FETCH_CSUM mechanism as the dump path, then verify_segment_csum() fetches the live data for that segment (fetch_check_value()), recomputes its checksum, and compares it (daos_csummer_compare_csum_info()), snapshotting a standalone copy of the recomputed checksum (snapshot_csum_info()) on a mismatch so it outlives the throwaway csummer. For array akeys, all overlapping segments are checked independently — a corrupted segment doesn't stop verification of the others, and got_csums[] correctly isolates which segment(s) failed.

As a drive-by cleanup in the same file, dump_csum_sv()/dump_csum_recx() had their cb_rc/rc double-bookkeeping simplified (no behavior change).

Test fixtures (tests/ddb_test_driver.c, tests/ddb_test_driver.h)

Adds a third checksum test object (g_oids[2]) with valid data but a deliberately corrupted stored checksum (single-byte flip applied to an otherwise-correct checksum before writing), for both the single-value and array-akey layouts:

  • csum_test_corrupt_sv_setup() — one corrupted SV.
  • csum_test_corrupt_recx_setup() — an array with DVT_FAKE_RECX_COUNT overlapping segments, only DVT_FAKE_RECX_BAD_IDX of which is corrupted, so per-entry isolation can be exercised (the other segment(s) must never be flagged).

Tests (tests/ddb_vos_tests.c)

Three new test cases under the existing csum test suite:

Test What it covers
check_csum_error_tests Invalid pool handle -> vos_cont_open failure propagation
check_csum_sv_tests SV path: no-csum (success, nothing to check), matching csum at a specific epoch and at EPOCH_MAX, corrupted csum (-DER_CSUM, got_csums[0] holds the recomputed value), no-callback no-op, callback-error propagation
check_csum_recx_tests Array path: no-csum, matching csum (multiple overlapping segments), corrupted csum with per-entry isolation (only the deliberately-corrupted segment is flagged), no-callback no-op, callback-error propagation

Steps for the author:

  • Commit message follows the guidelines.
  • Appropriate Features or Test-tag pragmas were used.
  • Appropriate Functional Test Stages were run.
  • At least two positive code reviews including at least one code owner from each category referenced in the PR.
  • Testing is complete. If necessary, forced-landing label added and a reason added in a comment.

After all prior steps are complete:

  • Gatekeeper requested (daos-gatekeeper added as a reviewer).

@knard38 knard38 self-assigned this Aug 26, 2026
@knard38 knard38 added the CR Catastrophic Recovery Feature label Aug 26, 2026
@github-actions

Copy link
Copy Markdown

Ticket title is 'Checksum management with ddb'
Status is 'In Progress'
https://daosio.atlassian.net/browse/DAOS-17321

Adds dv_check_csum() to the ddb VOS API (ddb_vos.c/.h), mirroring the
structure of the existing dv_dump_csum() (open container, build the
iod from path, dispatch by value type, close container) as an
independent implementation that additionally fetches the live data,
recomputes its checksum(s), and compares against what was fetched.

Results are reported through a callback with a got_csums array:
got_csums[i] holds the recomputed checksum when entry i's stored
checksum did not match, and is NULL when it matched or there was
nothing to check. The function returns -DER_CSUM if any checksum
entry fails to match.

Test coverage: unit tests for dv_check_csum() (single value and
array, matching/mismatching/no-checksum cases, and per-entry mismatch
isolation when one of several overlapping array segments is
corrupted), using extended VOS test fixtures (ddb_test_driver.c/.h)
for corrupted single-value and array checksums.

This is patch 1/3 of the DAOS-17321 csum_check split (supersedes
PR #18940): see patch-007 for the ddb command wiring and patch-008
for the Go CLI/documentation.

Features: recovery
Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
@knard38
knard38 force-pushed the ckochhof/dev/master/daos-17321/patch-006 branch from 243f712 to d64d9da Compare August 26, 2026 19:22
@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Cluster Box Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18941/1/execution/node/1599/log

@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Cluster Box Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18941/1/execution/node/1588/log

@knard38
knard38 requested a review from janekmi August 26, 2026 19:24
@knard38
knard38 marked this pull request as ready for review August 26, 2026 19:24
@knard38
knard38 requested review from Nasf-Fan and NiuYawei August 26, 2026 19:25
@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Hardware Large MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18941/2/execution/node/1724/log

@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18941/2/execution/node/1821/log

@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18941/2/execution/node/1874/log

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

Labels

CR Catastrophic Recovery Feature

Development

Successfully merging this pull request may close these issues.

3 participants