Skip to content

DAOS-19912 ddb: Check each csum extent with its own data - #19695

Draft
knard38 wants to merge 1 commit into
masterfrom
ckochhof/fix/master/daos-19912/patch-001
Draft

knard38 wants to merge 1 commit into
masterfrom
ckochhof/fix/master/daos-19912/patch-001

Conversation

@knard38

@knard38 knard38 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

dv_check_csum() (added by #18941) verifies each extent of an array value by reading its data back with a regular fetch by (major epoch, range) and comparing the checksum recomputed from that data with the stored one. That read cannot tell apart extents written at the same major epoch, as the operations of a distributed transaction are: they only differ by their minor epoch, and for the part of an extent that a later write hides, the read returns the bytes of that write instead of the bytes the checksum was computed on. Intact data is then reported as corrupted (-DER_CSUM). The same holds for a punch. This was found in the review of #18941: #18941 (comment)

Example from the review, with a record size of 1 and a chunk size of 4096, both writes at the same major epoch: A = [0, 1024) at minor epoch 1, then B = [0, 512) at minor epoch 3. The checksum-only fetch (VOS_OF_FETCH_CSUM) lists {0-511} (B) and {0-1023} (the whole of A, with its checksum). The re-read for the second entry returns the bytes of B on [0, 512) and those of A on [512, 1024), which do not match the checksum of A.

This PR verifies each listed extent with its own stored data instead. check_csum_recx() copies the whole extent of each entry of the checksum-only fetch with vos_ioh_recx_copy() (DAOS-19892, #19541) and recomputes the checksum from that copy, so every extent is checked against the bytes its checksums were computed on, hidden chunks included. Single values and csum_dump do not change.

dv_check_csum() has no caller outside ddb_tests yet. The csum_check command that will expose it (#18942 for the C API, #18943 for Go) stays draft until this PR has landed, so no command reports the false mismatch.

This PR builds on #19424 (DAOS-19907, test-only: the new test reuses its fixtures), which lands first. While it is not on master, Files changed also shows its commit.

Design

  • Array path: check_csum_recx() calls the new verify_extent_csum() for each entry of the list. It copies the whole extent of that entry with vos_ioh_recx_copy() into a buffer of rx_nr * re_rec_size bytes and verifies it against the checksum info listed at the same index. An extent that a later write splits is listed once per visible piece and verified once per entry, as before, and the buffer is as large as the extent, as before. The array path no longer nests a vos_obj_fetch() inside the open VOS_OF_FETCH_CSUM handle.
  • verify_segment_csum() and fetch_check_value() are replaced by three helpers. verify_data_csum() recomputes the checksum of a buffer and compares it with the stored one, for both paths. verify_sv_csum() fetches a single value (its size, then its data, as fetch_check_value() did) and verifies it: the single-value path behaves as before. csum_data_size_check() keeps the check that a checksummed value or extent has data behind it, with its fault injection, so check_csum_recx_inconsistent_tests still covers arrays.
  • The header comment of dv_check_csum() states that every listed extent is verified in full, with its own data.

Testing

One new ddb_tests test, check_csum_recx_minor_tests, with seven cases that each call dv_check_csum() at DAOS_EPOCH_MAX and check the result in their own callback, check_csum_recx_minor_cb_001 to _007 (the case numbers below), as check_csum_recx_tests() does. The layouts are those of DAOS-19907: records of size 1, chunks of C = 4096, extents of S = 8192 records (two chunks), crc64, every extent written at major epoch 10 with its own checksum. The later write is a VOS_OF_REBUILD update at the same epoch: without a DTX handle it has a greater minor epoch than a regular update (EVT_REBUILD_MINOR_MIN against VOS_SUB_OP_MAX), as the second operation of a transaction would. The callbacks check the range and the major epoch of each listed entry but not its minor epoch, which they do not receive yet (TODO DAOS-20080).

  • Cases 1 to 4, healthy extents on the objects of DAOS-19907: HEAD (A=[0, S) then B=[0, S/2), listed as {B, A}), MIDDLE (A=[0, 3C) then B=[C, 2C), listed as {A, B, A}) and CHUNK (A=[0, S) then B=[C/4, C/2), listed as {A, B, A}) over the range [0, 3C), as dump_csum_recx_minor_tests() does, then the range [C, 2C) of HEAD, where only A is listed and verified as a whole. The result is 0 and no entry is reported.
  • Cases 5 to 7, on a new object of the fixture, DVT_FAKE_MINOR_OID_BAD, one akey per layout, with the stored checksum of the first chunk of one extent corrupted: HEAD with A's hidden chunk corrupted, HEAD with B corrupted, and CHUNK with A's partly hidden chunk corrupted. The result is -DER_CSUM and only the corrupted extent is reported, on each of its entries (twice for A in CHUNK); its recomputed checksum differs from the stored one only by the corrupted byte.
  • HIDDEN of DAOS-19907 (A hides B entirely) is not checked: A, the only extent listed, is entirely visible, so a re-read returns its own data and the case cannot fail without this change either. The example of the review is not a case of its own: there B hides a part of a chunk of A, as in case 3, at the head of A, as in case 1. A probe runs it as written in the review (below).
  • Fixture: write_minor() of DAOS-19907 can corrupt the stored checksum of one chunk, and g_oids gains an eleventh object for DVT_FAKE_MINOR_OID_BAD. DVT_OID_COUNT (11) sizes g_oids, and DVT_TREE_OBJ_COUNT (10) keeps the tree that dvt_insert_data() builds for the other tests, and that ls_cmd_tests counts, at 10 objects.

Measured case by case (one process per case, since a failed case ends the test), with the ddb_vos.c of master or of this change compiled into the test binary: with master, the 7 cases fail (cases 1 to 4 and 6 report a healthy extent, cases 5 and 7 recompute the checksum of the corrupted extent over the visible data instead of its own); with this change, the 7 pass. Copying entry 0 instead of the entry's own index in verify_extent_csum() fails 6 of the 7 cases (only case 4, a list with a single entry, survives), so the cases do pin the index. A scratch probe with the example of the review written in one DTX handle (minor epochs 1 and 3, as in the review) returns -DER_CSUM with master (the whole of A, {0-1023}, is reported) and 0 with this change. The whole ddb_tests pass (87 tests), also under valgrind (no error, nothing lost), as do the 25 ddb_ut tests, and git-clang-format is clean, also against the merge-base with master.

Not covered: real transactions on an engine (the layouts are made through the VOS API), EC objects, checksum types other than crc64, and extents on NVMe (the pool of ddb_tests has no data blob; vos_ioh_recx_copy() itself is tested on NVMe by VOS402.3, #19541). Punches: ddb has no punch-specific code, and the two VOS properties it relies on (a punched range is not listed, an extent partly hidden by a punch is listed and copied whole) are properties of VOS that this PR does not test; they belong in the VOS unit tests. No functional test reaches dv_check_csum() until the csum_check command is wired (#18942, #18943); the end-to-end functional test is DAOS-20152.

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 Dec 3, 2026
@knard38 knard38 added bug CR Catastrophic Recovery Feature release-3.0.0 Targeted for release 3.0.0 labels Dec 3, 2026
@knard38
knard38 changed the base branch from master to ckochhof/dev/master/daos-19907/patch-001 December 3, 2026 15:00
@knard38
knard38 changed the base branch from ckochhof/dev/master/daos-19907/patch-001 to master December 3, 2026 15:01
@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-19695/3/execution/node/1887/log

dv_check_csum() verified each extent of an array value by reading
its data back with a regular fetch by (major epoch, range). That read
cannot tell apart extents written at the same major epoch, as the
updates of a distributed transaction are, and returns the data of the
later write for the part of the extent that it hides: healthy data
was reported as corrupted (-DER_CSUM).

Verify each listed extent with its own stored data instead, copied
with vos_ioh_recx_copy(), hidden chunks included. Single values are
not changed.

Features: recovery

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
@knard38
knard38 force-pushed the ckochhof/fix/master/daos-19912/patch-001 branch from 659bcf9 to 1391fff Compare December 4, 2026 19:31
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Ticket title is 'ddb: csum check reports -DER_CSUM on healthy extents overwritten at the same major epoch'
Status is 'In Progress'
Labels: 'CheckSum,catastrophic_recovery,ddb'
https://daosio.atlassian.net/browse/DAOS-19912

This branch has not been deployed

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

Labels

bug CR Catastrophic Recovery Feature release-3.0.0 Targeted for release 3.0.0

Development

Successfully merging this pull request may close these issues.

2 participants