Proposal to introduce error code levels for WT_TRET

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines - Foundations
    • 1,604.648
    • None
    • None

      Issue Summary

      The macro __WT_TRET_WINS was recently created in WT-17140 to enhance maintainability. There is a proposal to further improve error handling by introducing distinct levels of error codes, such as 'dominant' and 'soft', to clarify precedence and simplify logic.

      Context

      • Current macro implementation:
        #define __WT_TRET_WINS(__ret) (__WT_RET_DOMINANT(__ret) || __WT_RET_SOFT(ret))
        
      • Suggested approach:
        /* The incoming error is unconditionally dominant. */
        #define __WT_RET_DOMINANT(__ret)  ((__ret) == WT_PANIC)
        /* The current ret is soft enough that any real error should override it. */
        #define __WT_RET_SOFT(ret)        ((ret) == 0 || (ret) == WT_DUPLICATE_KEY || (ret) == WT_NOTFOUND || (ret) == WT_RESTART)
        
      • This would allow clearer error precedence and more maintainable code when handling return values in WiredTiger.

      Proposed Solution

      • Implement macros for different error code levels (e.g., _WT_RET_DOMINANT, _WT_RET_SOFT)
      • Refactor usages of __WT_TRET_WINS to leverage these new macros
      • Review and document the error precedence logic

      Original Slack thread: Slack Thread
      This ticket was generated by AI from a Slack thread.

            Assignee:
            Unassigned
            Reporter:
            Memento Slack Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: