ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • WT12.0.0
    • Affects Version/s: None
    • Component/s: Tools, Verify
    • None
    • Storage Engines - Persistence
    • 66.832
    • StorEng - Defined Pipeline
    • None

      Problem

      In __verify_config_offsets() (src/btree/bt_vrfy.c), the dump_offsets loop stores the result of the blind block read with WT_TRET(), but the next evaluation of the loop condition overwrites ret:

      while ((ret = __wt_config_next(&list, &k, &v)) == 0) {
          ...
          WT_TRET(__wti_debug_offset_blind(...));   /* sets ret ... */
      }                                             /* ... and the next __wt_config_next resets it */
      return (ret == WT_NOTFOUND ? 0 : ret);
      

      For the usual single-offset list, the next call returns WT_NOTFOUND, so the function returns 0. The failed read is still logged as an [ERROR], but both WT_SESSION::verify and wt verify report success.

      Reproduction (current develop, Debug + HAVE_DIAGNOSTIC=1):

      Create a table, checkpoint, close, then ask for an offset past end of file:

      $ build/wt -h /tmp/db verify -d dump_offsets=1048576 file:t.wt
      ... ERROR: pread: failed to read 4096 bytes at offset 1048576: WT_ERROR ...
      $ echo $?
      0
      

      The same happens through the Python API: session.verify(uri, 'dump_offsets=[4096]') returns 0 after logging the read error.

      Impact

      Debugging flag only, and only in diagnostic builds, so no data-path exposure. However it is the flag engineers reach for when triaging corruption, and it reports a successful dump when the block could not be read.

      The non-diagnostic branch of the same code returns ENOTSUP with WT_RET_MSG directly, so propagating the error matches the existing behaviour of the other path.

      This also masks the guard being added for WT-18952 / WT-17779: an EINVAL from the blind read would be logged and then swallowed.

      Fix

      Replace WT_TRET() with WT_RET() in __verify_config_offsets(). A bad offset then aborts the dump list and the error reaches the caller. Trade-off: remaining offsets in the list are not dumped; acceptable for a debugging flag, and it matches the non-diagnostic branch.

      Definition of done

      • WT_RET() in __verify_config_offsets().
      • Python test (skipped unless wiredtiger.diagnostic_build()) that verifies a table with a dump_offsets entry past end of file and asserts the call returns an error. The test must fail before the fix (verify returns 0) and pass after.
      • No regressions in the Python suite.

      Related: WT-18952 (blind read of a block with no backing file), WT-13220 (error handling for invalid dump_offsets usage).

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: