Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-14227

Add a hook in SWIG to print sub_level_error values when an error is return

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Test Python
    • None
    • Storage Engines
    • 8

      When our python tests call a WiredTiger function that fails we print out the top level error, but it would be useful to also see the sub_level_error codes when they are available since they provide more useful context into the failure.

      For example if we try to open a backup cursor when WiredTiger is in live restore mode the top level error is just

       

      _wiredtiger.WiredTigerError: Invalid argument 

      while sub_level_error details provide us the more useful

      WT_CONFLICT_LIVE_RESTORE, "backup cannot be taken when live restore is enabled" 

       

       

      Here's an example of printing additional details at the python layer when failing to open a backup cursor.

      try:  
          backup_session = self.conn.open_session("backup:")
      except wiredtiger.WiredTigerError:  
          err, sub_level_err, err_msg = self.session.get_last_error()
          self.prout(f"Error: {err}  {sub_level_err} {err_msg}"

      but ideally we can hook this logic into the SWIG interface to automatically report this on a failure.

      SWIG_ERROR_IF_NOT_SET in wiredtiger.i is a a good starting point, but we need to determine how to access the session and call WT_SESSION::get_last_error() to access the sub_level_error data, along with any required NULL checking.

       

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            andrew.morton@mongodb.com Andrew Morton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: