Errors recorded on an internal schema session are discarded before get_last_error

XMLWordPrintableJSON

    • Storage Engines - Foundations
    • 287.483
    • SE Foundations - 2026-09-15
    • None

      __wti_schema_internal_session() opens an internal session for a schema operation when a transaction is running, and the operation's error is recorded on that session.

      The internal session's api_call_counter starts at zero, so any later cursor or session API call on it enters API_SESSION_INIT (src/include/api.h) as a top-level call and resets the error information because err_info.err != 0. __wti_schema_session_release() then sees err == 0 and copies nothing back to the caller's session.

      WT_SESSION::get_last_error therefore reports the sub-level error as WT_NONE with an empty message. The returned error code is still correct.

      Observed with a table drop that records (EBUSY, WT_UNCOMMITTED_DATA, "the table has uncommitted data and cannot be closed yet") on the internal session and then performs a metadata cursor operation before returning; the caller sees (EBUSY, WT_NONE, ""). Any schema operation that records an error on an internal session and then issues a further API call on it is affected.

      Suggested fix: do not reset the error information on API entry for an internal session, or preserve it across __wti_schema_session_release().

            Assignee:
            Yury Ershov
            Reporter:
            Alex Blekhman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: