Fix disagg hook to handle multithreading in tests

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Test Python
    • None
    • Storage Engines, Storage Engines - Foundations
    • SE Foundations - 2025-08-15
    • 3

      Multithreaded tests don't work with the disagg hook.  The problem is that currently, the hook functions uses thread local storage to get the current testcase object.  The testcase object stores, for example, a list of URIs that have been transformed from "table:" names to "layered:" names.

      For example, run

      python3 ../test/suite/run.py --hook disagg -v 2 checkpoint02 

      and it hangs. Looking at the output from the test:

      $ cat ../../build/WT_TEST/test_checkpoint02.0/std*
      Exception in thread Thread-2:
      Traceback (most recent call last):
        File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
          self.run()
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/wtthread.py", line 174, in run
          c = sess.open_cursor(self.uris[0], None, None)
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/wthooks.py", line 204, in <lambda>
          f = lambda self, *args: hooked_function(self, orig_func, hook_info_name, *args)
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/wthooks.py", line 127, in hooked_function
          ret = call_func(self, *args)
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/hook_disagg.py", line 338, in <lambda>
          session_open_cursor_replace(orig_session_open_cursor, s, uri, todup, config))
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/hook_disagg.py", line 253, in session_open_cursor_replace
          uri = replace_uri(uri)
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/hook_disagg.py", line 182, in replace_uri
          if is_layered(uri):
        File "/home/dda/wt/git/wt-14782-python-disagg-triage-checkpoint/test/suite/hook_disagg.py", line 174, in is_layered
          return uri in testcase.layered_uris

      In this case, the thread is calling open_cursor, and that function is transforming the URIs, for which it needs the testcase.

      I think the solution might be to pass the test case object to the thread on creation, and in the thread, do this:

          threadLocal = threading.local()
          threadLocal.currentTestCase = testcase
      

              Assignee:
              [DO NOT USE] Backlog - Storage Engines Team
              Reporter:
              Donald Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: