[SERVER-72885] Are change events of a single transaction always grouped together? Created: 17/Jan/23 Updated: 18/Jan/23 Resolved: 18/Jan/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Kiruphasankaran Nataraj | Assignee: | Yuan Fang |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The change event associated with a transaction comes with a lsid and a txnNumber which helps to uniquely identify a transaction. When executing transactions from multiple clients concurrently, is it guaranteed that the change events of a transaction are always grouped together? |
| Comments |
| Comment by Yuan Fang [ 18/Jan/23 ] |
|
Thank you for bringing this to our attention and providing a detailed explanation. To quickly answer your question, change events of a single transaction in MongoDB are not guaranteed to always be grouped together. Thus, the second scenario in your comment is possible. For more information, please refer to Regards, |
| Comment by Kiruphasankaran Nataraj [ 18/Jan/23 ] |
|
This is in the context of Change Streams. While opening a Change Stream on a MongoDB deployment, is it guaranteed that the change events of a transaction always appear together without any interleaving operations even if multiple clients execute multiple transactions on the same deployment concurrently? For example, if two transactions are executed with 4 inserts, say Txn1 and Txn2, currently the change events as observed as follows (lsid and txnNumber values are assumed for simplicity):
For the change events associated with a single transaction, the lsid and txnNumber is the same and the above example shows the change events associated with each individual transaction being grouped together. Is there a possibility of the change events of a transaction appearing interleaved or mixed within the change events of another transaction? For example, is there a possibility of the change events appearing as follows:
|