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

POC: Small improvements to make using Control points easier, renaming for consistency, and fix error handling

    • Storage Engines
    • 2
    • StorEng - 2024-10-29

      Note, except for renaming the macros and renaming predicate "Parm match" the renaming might be deferred to another ticket. It is not clear which ticket will go in first: this one or WT-13569. To avoid causing extra renaming for WT-13569 if it goes in second, the remaining renaming is left until it is known which ticket will go in first.

      • Macro CONNECTION_CONTROL_POINT_WAIT_FOR_TRIGGER() returns whether the control point was enabled. This requires extra code lines to call the macro. Either allow passing NULL to not return whether the control point was enabled, or change it to not return whether the control point was enabled.
      • Using new predicate "Param match" requires extra code lines at the call site and/or (usually and) the trigger site.
        • Add two macros to set the two parameters: CONNECTION_CONTROL_POINT_SET_WAIT_FOR_TRIGGER_CALL_PARAM() and CONNECTION_CONTROL_POINT_SET_WAIT_FOR_TRIGGER_TRIGGER_PARAM() for the call site and trigger (define) site, respectively.
        • Add a variant of macro CONNECTION_CONTROL_POINT_DEFINE_WAIT_FOR_TRIGGER() with an additional parameter to set the trigger site parameter: CONNECTION_CONTROL_POINT_DEFINE_WAIT_FOR_TRIGGER_AND_SET_TRIGGER_PARAM().
      • Renaming for consistency or better readability.
        • Rename __ wt_ {conn,session}control_point_init_all() to __ wt{conn,session}

          _control_point_register_all().

        • Rename macro CONNECTION_CONTROL_POINT_WAIT_FOR_TRIGGER() to CONNECTION_CONTROL_POINT_DO_WAIT_FOR_TRIGGER().
        • In the naming convention the first name portion following _control_point should be the type to which the function belongs, and the second should be what (config parsing, data, init function, etc.) is named.
          • Rename action configuration parsing function from __ wt_control_point_config_action_<action> to __ wt_control_point_action_config_<action>.
          • Rename action data struct tag name from __ wt_control_point_action_<action> to __ wt_control_point_action_data_<action>.
          • Rename action data type name from WT_CONTROL_POINT_ACTION_<action> to WT_CONTROL_POINT_ACTION_DATA_<action>.
          • Rename predicate configuration parsing function from __ wt_control_point_config_pred_<action> to __ wt_control_point_pred_config_<action>
      • Provide some inline functions for reading various things related to control points. (These are inline functions instead of macros since they are not commonly used.)
        • __ wti_{conn,session}_control_point_get_registry().
        • __ wt_{conn,session}_control_point_get_crossing_count().
        • __ wt_{conn,session}_control_point_get_trigger_count().
        • __ wti_{conn,session}_control_point_get_data().
        • __ wt_{conn,session}_control_point_is_enabled().
        • __ wt_{conn,session}_control_point_get_param1().
        • __ wt_{conn,session}_control_point_get_param2().
      • Provide some inline functions for setting param1 and param2 - Warning, these changes are undone if the control point is disabled and enabled again. These are primarily used with predicate "Param match". They are the implementation of the "Param match" macros above.
        • __ wt_{conn,session}_control_point_set_param1_ptr().
        • __ wt_{conn,session}_control_point_set_param2_ptr().
      • Rename "Param match" to "Param 64 match" so that other 32-bit, and 16-bit variants can be added if needed.
      • Some control point error checking return WT_ERROR. Returning WT_ERROR causes an abort. Return some other error instead, possibly EINVAL.

            Assignee:
            tod.johnson@mongodb.com Tod Johnson (Inactive)
            Reporter:
            tod.johnson@mongodb.com Tod Johnson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: