Operational Defect Database

BugZero found this defect 48 days ago.

MongoDB | 2628023

clusterTime values are duplicated in change stream events

Last update date:

4/1/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

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.

Top User Comments

jeff.yemin commented on Mon, 1 Apr 2024 19:00:25 +0000: Not a problem at all. Now that I know we will just update the Java driver test to reflect this. Easy to do by just inserting the two documents in two commands instead of in bulk.

Steps to Reproduce

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

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Needs Verification

Learn More

Search:

...