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

Only create the metrics monitor component when enabled in the cppsuite

    • Type: Icon: Technical Debt Technical Debt
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • 2
    • StorEng - Defined Pipeline

      Summary
      We can either enable or disable the different components in the cppsuite. In the constructor of the test class, we allocate them. Due to some mistakes in the design and dependencies, even when disabled we are allocating memory for other components such as the timestamp manager as we need it when instantiating other objects. However, this is not the case for the metrics monitor. We should only create this component if it is enabled in the configuration file. 

      Motivation

      • Does this affect any team outside of WT?
        Better code
      • Is this issue urgent?
        No

      Acceptance Criteria (Definition of Done)
      Only generate the metrics monitor if enabled through the configuration file.

      Suggested Solution
      Using smart pointers would be better:

      --- a/test/cppsuite/src/main/test.cpp
      +++ b/test/cppsuite/src/main/test.cpp
      @@ -36,8 +36,16 @@ namespace test_harness {
       test::test(const test_args &args) : _args(args)
       {
           _config = new configuration(args.test_name, args.test_config);
      -    _metrics_monitor =
      -      new metrics_monitor(args.test_name, _config->get_subconfig(METRICS_MONITOR), _database);
      +
      +    configuration * metrics_monitor_cfg = _config->get_subconfig(METRICS_MONITOR);
      +    if(metrics_monitor_cfg->get_optional_bool(ENABLED, false)) {
      +      _metrics_monitor =
      +        new metrics_monitor(args.test_name, metrics_monitor_cfg, _database);
      +        _components.push_back(_metrics_monitor);
      +    } else {
      +      delete metrics_monitor_cfg;
      +    }
      +
           _timestamp_manager = new timestamp_manager(_config->get_subconfig(TIMESTAMP_MANAGER));
           _workload_manager = new workload_manager(
             _config->get_subconfig(WORKLOAD_MANAGER), this, _timestamp_manager, _database);
      @@ -51,7 +59,7 @@ test::test(const test_args &args) : _args(args)
            * Ordering is not important here, any dependencies between components should be resolved
            * internally by the components.
            */
      -    _components = {_workload_manager, _timestamp_manager, _metrics_monitor};
      +    _components = {_workload_manager, _timestamp_manager};
       }
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: