Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-72363

Consider removing CollectionStatistics::addHistogram method

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • QO 2023-01-23

      A CollectionStatistics is not concerned about the source of histograms. E.g., CollectionStatisticsImpl should get its data from from the stats cache that is accessed when CollectionStatisticsImpl::getHistogram is called. While CollectionStatisticsMock used it tests should provide a more flexible interface to return custom histograms.

      That said, it seem that CollectionStatistics::addHistogram should not be part of the CollectionStatistics interface and we may consider removing it.

      To facilitate testing the addHistogram method can be kept in the CollectionStatisticsMock class.

      Another idea proposed by Misha would be changing addHistogram to a private _addHistogram and adding addHistogramForTest to clarify that this API is only for testing.

      In addition, currently when addHistogram is called providing a path for which a histogram already exists, we silently replace the old entry. If this behaviour is fine, we may consider changing the name to addOrReplaceHistogram, or otherwise raise an error.

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            anton.korshunov@mongodb.com Anton Korshunov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: