Support snapshot read with an external provided timestamp

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.5.0
    • Component/s: Read Operations
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      We have a use case in which we want to read consistency data between service calls.

      For example:

      • Service A calls Service B.
        • Service B returns the data from MongoDB and the session timestamp.
      • Service A then processes the data.
      • Possible: Service C changes the data in MongoDB.
      • Service A then calls Service B again, this time with the session timestamp from the first call.
        • Service B returns the data from MongoDB with the provided session timestamp, excluding changed data from Service C.

      Note: We ensure that the time between the two read operations is short enough for Mongo to provide the data.

      This solution was proposed by our MongoDB consultant.

      Currently, we use the following code to set the snapshot time for the read operation:

      session = await _mongoClient.StartSessionAsync(new ClientSessionOptions() { Snapshot = true }, cancellationToken);            session.WrappedCoreSession.SetSnapshotTimeIfNeeded(snapshotTimestamp.BsonTimestamp); 

      This code uses the internals of the MongoDB driver, and there have been discussions to remove the WrappedCoreSession property.

       

      We need an officially supported way to read snapshots with an externally provided timestamp.

            Assignee:
            Unassigned
            Reporter:
            Christoph Schnuck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: