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

clusterTime values are duplicated in change stream events

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • Replication
    • ALL
    • Hide
      1. Start a change stream
      2. Insert two documents in a single insert command
      3. Wait for change stream to deliver events for the two documents

      Expected result: Each event includes a unique value for clusterTime, and the value is ascending.

      I observe this behavior testing against:

          "version": "8.0.0-alpha1-29-g1a70849",
          "gitVersion": "1a70849e14f429693786ea53168d660c686ca622",
      

      and all prior server releases.

      Actual result: The value of clusterTime is identical for the two events

      I observe this behavior testing against

          "version": "8.0.0-alpha2-76-g80adfd2",
          "gitVersion": "80adfd256dd70ed903f84f4f8985a832355bfdcd",
      

      Evergreen patch demonstrating the failure: https://spruce.mongodb.com/task/mongo_java_driver_tests_jdk_secure__version~latest_os~linux_topology~replicaset_auth~auth_ssl~ssl_jdk~jdk17_test_patch_9a02f8102531ed1fbce140cef4668f52844facca_660af005e6cd580007699eca_24_04_01_17_34_19?execution=0&sortBy=STATUS&sortDir=ASC

       

      Show
      Start a change stream Insert two documents in a single insert command Wait for change stream to deliver events for the two documents Expected result : Each event includes a unique value for clusterTime, and the value is ascending. I observe this behavior testing against: "version" : "8.0.0-alpha1-29-g1a70849" , "gitVersion" : "1a70849e14f429693786ea53168d660c686ca622" , and all prior server releases. Actual result : The value of clusterTime is identical for the two events I observe this behavior testing against "version" : "8.0.0-alpha2-76-g80adfd2" , "gitVersion" : "80adfd256dd70ed903f84f4f8985a832355bfdcd" , Evergreen patch demonstrating the failure : https://spruce.mongodb.com/task/mongo_java_driver_tests_jdk_secure__version~latest_os~linux_topology~replicaset_auth~auth_ssl~ssl_jdk~jdk17_test_patch_9a02f8102531ed1fbce140cef4668f52844facca_660af005e6cd580007699eca_24_04_01_17_34_19?execution=0&sortBy=STATUS&sortDir=ASC  

      Two change stream events, generated from the execution of an insert command containing two documents, both having the same clusterTime value.

      {"cursor": {"nextBatch": [
      {"_id": {"_data": "82660AF114000000022B042C0100296E5A10043DA2BBD326BC4B7798739AC6DA4FE305463C6F7065726174696F6E54797065003C696E736572740046646F63756D656E744B657900461E5F6964002B02000004"}, "operationType": "insert", "clusterTime": {"$timestamp": {"t": 1711993108, "i": 2}}, "wallTime": {"$date": "2024-04-01T17:38:28.212Z"}, "fullDocument": {"_id": 1, "a": 1}, "ns": {"db": "JavaDriverTest", "coll": "com.mongodb.internal.operation.ChangeStreamOperationSpecification"}, "documentKey": {"_id": 1}}, {"_id": {"_data": "82660AF114000000022B042C01002B026E5A10043DA2BBD326BC4B7798739AC6DA4FE305463C6F7065726174696F6E54797065003C696E736572740046646F63756D656E744B657900461E5F6964002B04000004"}, "operationType": "insert", "clusterTime": {"$timestamp": {"t": 1711993108, "i": 2}}, "wallTime": {"$date": "2024-04-01T17:38:28.212Z"}, "fullDocument": {"_id": 2, "a": 2}, "ns": {"db": "JavaDriverTest", "coll": "com.mongodb.internal.operation.ChangeStreamOperationSpecification"}, ...
      

      This was found via an integration test of startAtOperationTime for change streams, in the Java driver. The test assumes that, at least outside of a transaction, that:

      1. clusterTime values are unique
      2. clusterTime values are ascending

      If this assumption is false, then we will need to re-write the test. It has held true from 4.0 until now.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: