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

updateLookup should use the best identifier between the collection UUID and name

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Change streams
    • None
    • Query Execution

      When SERVER-31946 will be fixed, we'll be able to use collection UUID instead of its name to lookup for a single document.

      Unfortunately, this won't solve all the issues for changestreams.

      Workflow 1:

      • t1: You have a collection A (UUID1) on which you update a document with id1.
      • t2: You rename that collection to B (UUID1).
      • t3: You create a new collection A (UUID2) and insert a document with id1.

      When opening a changestream at t0 on the cluster or database, the updateLookup from t1 needs to read the latest version of document id1 from the collection using its UUID to retrieve the correct document. Using the collection name will retrieve the document inserted at t3 in the new collection named A.

      Workflow 2:

      • t1: You update a document with id1 in a collection A (UUID1).
      • t2: You rename that collection to B (UUID1).
      • t3: You update the document with id1 in collection B (UUID1).

      This time, when opening a changestream at t0 on the collection, the updateLookup from t1 needs to read the latest version of document id1 from the collection using its name to retrieve the correct document. Using the collection UUID will retrieve the document inserted at t3 which should not be visible as the rename event will invalidate the changestream.

       

      To generalize, when the changestreams are limited to a collection name, the updateLookup should continue using the collection name, and when the changestreams are cluster or database wide, it should use the UUID.

      Of course, even is this behaviour is probably the most likely to work most of the time, there will always be special cases. For this, we would also need to add a parameter to changestreams to override it.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            sebastien.mendez@mongodb.com Sebastien Mendez
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: