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

Create LOG(v2) helpers for collection-type objects

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.0-rc7, 4.7.0
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Fully Compatible
    • v4.4
    • Execution Team 2020-05-04, Execution Team 2020-05-18

      There's a request to standardize that a collection's <database.collection> string representation are logged with the attribute key "namespace". Additionally, it's often useful to have the associated UUID. While it's unlikely we can completely codify that a mistake never happens, the following helpers would go a long way by making it easier to log the right thing than the wrong thing:
      Instead of being forced to type, e.g:

      LOGV2(0, "Dropping collection", "namespace"_attr = collection->ns(), "uuid"_attr = collection->uuid());
      

      The following example API (not the mandated solution) would be easier and safer:

      LOGV2(0, "Dropping collection", Attr(collection));
      

      Additionally, some methods don't have collection objects, but `Namespace` objects. Having those transformed (without the UUID component) would also be beneficial.

      Note there are some more complicated, but uncommon scenarios that may not be worth covering. Such as log lines for renaming collections that can include source/target and temporary collections. The suggested guidance for those cases is to log sourceNamespace and targetNamespace. Having that possible would be a win, but not a requirement.

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: