Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-57340

Allow const iteration for DcpConnMap::each()

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • backlog
    • 7.2.0, 7.2.1
    • couchbase-bucket
    • 0

    Description

      Follow-up to MB-56891 - while those MBs educed the cost of generating "dcp" and "dcpagg" stats by not holding the DcpConnMap lock for the duration of the stat call (see https://review.couchbase.org/c/kv_engine/+/191090), we still iterate on the items as a non-const - i.e. the function passed to DcpConnMap::each() takes a non-const std::shared_ptr<ConnHandler>.

      We can improve this by not passing around the owning std::shared_ptr<> elements to the passed in function (which could reduce refcount incr/decr), and adding a const overload of each() which in turn would allow const versions of methods used by users of each() to be called.

      It's not exactly clear what the benefit of these changes would be - it appears that the non-const methods called as part of iteration - such as DcpConsumer::addStats() - don't really suffer from being a non-const variant - for example I don't immediately see any exclusive locks being taken. As such, setting this to backlog for now, until we have any specific details on the benefit this brings.

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-57340
          # Subject Branch Project Status CR V

          Activity

            People

              owend Daniel Owen
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are 2 open Gerrit changes

                  PagerDuty