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

Refactor wt util tool to remove redundant variables in config handling

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tools
    • Storage Engines
    • None
    • None

      In src/utilities/util_main.c within the switch statement, the current implementation sets both the config variables (e.g. readonly_config, salvage_config) and the corresponding boolean flags (e.g. readonly, salvage)

      However, these config variables are redundant because the boolean flags alone are enough to determine the behaviour.

      I.e. Instead of:

      ...
      case 'r':
      readonly_config = READONLY;
      readonly = true;
      break;
      
      case 'S': /* salvage */
      salvage_config = SALVAGE;
      salvage = true;
      break;
      ...

      Do:

      ...
      case 'r': 
      readonly = true; 
      break;
      
      case 'S': /* salvage */ 
      salvage = true; 
      break; 
      ...

       

      Ensure that any code replying on the configuration variables is updated to use the boolean flags instead. For example:

      if (readonly_config != NULL)
      len += strlen(readonly_config); 

      Should be refactored to:

      if (readonly)
      conn_config = READONLY;
      

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            mariam.mojid@mongodb.com Mariam Mojid
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: