parameters: (recovery_unit_impl_type)
docstring: GDB in-process python supplement.
docstring_summary: GDB in-process python supplement.
docstring_tokens: GDB in - process python supplement .
function: def dump_recovery_units(recovery_unit_impl_type):  # pylint: disable=too-many-locals
          """GDB in-process python supplement."""
  
          # Temporarily disable printing static members to make the output more readable
          out = gdb.execute("show print static-members", from_tty=False, to_string=True)
          enabled_at_start = False
          if out.startswith("Printing of C++ static members is on"):
              enabled_at_start = True
              gdb.execute("set print static-members off")
  
          # Dump active recovery unit info for each client in a mongod process
          service_context = get_global_service_context()
          client_set = absl_get_nodes(service_context["_clients"])  # pylint: disable=undefined-variable
  
          for client_handle in client_set:
              client = client_handle.dereference().dereference()
  
              # Prepare structured output doc
              client_name = str(client["_desc"])[1:-1]
              operation_context_handle = client["_opCtx"]
              output_doc = {"client": client_name, "opCtx": hex(operation_context_handle)}
  
              recovery_unit_handle = None
              recovery_unit = None
              if operation_context_handle:
                  operation_context = operation_context_handle.dereference()
                  recovery_unit_handle = get_unique_ptr(operation_context["_recoveryUnit"])  # pylint: disable=undefined-variable
                  # By default, cast the recovery unit as "mongo::WiredTigerRecoveryUnit"
                  recovery_unit = recovery_unit_handle.dereference().cast(
                      gdb.lookup_type(recovery_unit_impl_type))
  
              output_doc["recoveryUnit"] = hex(recovery_unit_handle) if recovery_unit else "0x0"
              wt_session = get_wt_session(recovery_unit, recovery_unit_impl_type)
              if wt_session:
                  output_doc["WT_SESSION"] = hex(wt_session)
              print(json.dumps(output_doc))
              if recovery_unit:
                  print(recovery_unit)
  
          # Dump stashed recovery unit info for each session in a mongod process
          for session_kv in get_session_kv_pairs():
              session_runtime_info = get_unique_ptr(session_kv["second"]).dereference()  # pylint: disable=undefined-variable
              session = session_runtime_info["session"]
  
              # Prepare structured output doc
              session_lsid = str(session["_sessionId"]["_id"])[1:-1]
              txn_participant_dec = get_decoration(session, "TransactionParticipant")
              output_doc = {"session": session_lsid, "txnResourceStash": "0x0"}
  
              recovery_unit_handle = None
              recovery_unit = None
              if txn_participant_dec:
                  txn_participant_observable_state = txn_participant_dec[1]["_o"]
                  txn_resource_stash = get_boost_optional(
                      txn_participant_observable_state["txnResourceStash"])
  
                  if txn_resource_stash:
                      output_doc["txnResourceStash"] = str(txn_resource_stash.address)
                      recovery_unit_handle = get_unique_ptr(txn_resource_stash["_recoveryUnit"])  # pylint: disable=undefined-variable
                      # By default, cast the recovery unit as "mongo::WiredTigerRecoveryUnit"
                      recovery_unit = recovery_unit_handle.dereference().cast(
                          gdb.lookup_type(recovery_unit_impl_type))
  
              output_doc["recoveryUnit"] = hex(recovery_unit_handle) if recovery_unit else "0x0"
              wt_session = get_wt_session(recovery_unit, recovery_unit_impl_type)
              if wt_session:
                  output_doc["WT_SESSION"] = hex(wt_session)
              print(json.dumps(output_doc))
              if recovery_unit:
                  print(recovery_unit)
  
          if enabled_at_start:
              gdb.execute("set print static-members on")
function_tokens: def dump_recovery_units ( recovery_unit_impl_type ) : # pylint: disable=too-many-locals # Temporarily disable printing static members to make the output more readable out = gdb . execute ( "show print static-members" , from_tty = False , to_string = True ) enabled_at_start = False if out . startswith ( "Printing of C++ static members is on" ) : enabled_at_start = True gdb . execute ( "set print static-members off" ) # Dump active recovery unit info for each client in a mongod process service_context = get_global_service_context ( ) client_set = absl_get_nodes ( service_context [ "_clients" ] ) # pylint: disable=undefined-variable for client_handle in client_set : client = client_handle . dereference ( ) . dereference ( ) # Prepare structured output doc client_name = str ( client [ "_desc" ] ) [ 1 : - 1 ] operation_context_handle = client [ "_opCtx" ] output_doc = { "client" : client_name , "opCtx" : hex ( operation_context_handle ) } recovery_unit_handle = None recovery_unit = None if operation_context_handle : operation_context = operation_context_handle . dereference ( ) recovery_unit_handle = get_unique_ptr ( operation_context [ "_recoveryUnit" ] ) # pylint: disable=undefined-variable # By default, cast the recovery unit as "mongo::WiredTigerRecoveryUnit" recovery_unit = recovery_unit_handle . dereference ( ) . cast ( gdb . lookup_type ( recovery_unit_impl_type ) ) output_doc [ "recoveryUnit" ] = hex ( recovery_unit_handle ) if recovery_unit else "0x0" wt_session = get_wt_session ( recovery_unit , recovery_unit_impl_type ) if wt_session : output_doc [ "WT_SESSION" ] = hex ( wt_session ) print ( json . dumps ( output_doc ) ) if recovery_unit : print ( recovery_unit ) # Dump stashed recovery unit info for each session in a mongod process for session_kv in get_session_kv_pairs ( ) : session_runtime_info = get_unique_ptr ( session_kv [ "second" ] ) . dereference ( ) # pylint: disable=undefined-variable session = session_runtime_info [ "session" ] # Prepare structured output doc session_lsid = str ( session [ "_sessionId" ] [ "_id" ] ) [ 1 : - 1 ] txn_participant_dec = get_decoration ( session , "TransactionParticipant" ) output_doc = { "session" : session_lsid , "txnResourceStash" : "0x0" } recovery_unit_handle = None recovery_unit = None if txn_participant_dec : txn_participant_observable_state = txn_participant_dec [ 1 ] [ "_o" ] txn_resource_stash = get_boost_optional ( txn_participant_observable_state [ "txnResourceStash" ] ) if txn_resource_stash : output_doc [ "txnResourceStash" ] = str ( txn_resource_stash . address ) recovery_unit_handle = get_unique_ptr ( txn_resource_stash [ "_recoveryUnit" ] ) # pylint: disable=undefined-variable # By default, cast the recovery unit as "mongo::WiredTigerRecoveryUnit" recovery_unit = recovery_unit_handle . dereference ( ) . cast ( gdb . lookup_type ( recovery_unit_impl_type ) ) output_doc [ "recoveryUnit" ] = hex ( recovery_unit_handle ) if recovery_unit else "0x0" wt_session = get_wt_session ( recovery_unit , recovery_unit_impl_type ) if wt_session : output_doc [ "WT_SESSION" ] = hex ( wt_session ) print ( json . dumps ( output_doc ) ) if recovery_unit : print ( recovery_unit ) if enabled_at_start : gdb . execute ( "set print static-members on" )