[SERVER-64780] Resharding change stream events are not filtered by namespace Created: 22/Mar/22  Updated: 29/Oct/23  Resolved: 06/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.2.1, 5.3.0-rc4
Fix Version/s: 5.3.2, 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Bernard Gorman Assignee: Mickey Winters
Resolution: Fixed Votes: 0
Labels: pm1950-m2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File reshard_namespace_filter.js    
Issue Links:
Backports
Problem/Incident
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.3
Sprint: QE 2022-04-04, QE 2022-04-18
Participants:
Linked BF Score: 174

 Description   

If a change steam is opened on a particular collection with showMigrationEvents:true and a resharding operation happens on another collection, the stream will erroneously report reshardBegin and reshardDoneCatchup events.

This issue does not appear to happen on 5.0, and was likely introduced during the extensive change stream rewrite in PM-1942.



 Comments   
Comment by Githook User [ 17/May/22 ]

Author:

{'name': 'Mickey. J Winters', 'email': 'mickey.winters@mongodb.com', 'username': 'mjrb'}

Message: SERVER-64780 don't run resharding_change_stream_namespace_filtering.js against 5.2
Branch: v5.3
https://github.com/mongodb/mongo/commit/e6e30bc9e1addec31a5d01aa9769d48e5dcfe2e1

Comment by Githook User [ 28/Apr/22 ]

Author:

{'name': 'Mickey. J Winters', 'email': 'mickey.winters@mongodb.com', 'username': 'mjrb'}

Message: SERVER-64780 filter out resharding events that aren't related to the namespace being watched by a changeStream
Branch: v5.3
https://github.com/mongodb/mongo/commit/18ad6a3c107d165be8b66b6b4be25c849d34f814

Comment by Githook User [ 06/Apr/22 ]

Author:

{'name': 'Mickey. J Winters', 'email': 'mickey.winters@mongodb.com', 'username': 'mjrb'}

Message: SERVER-64780 filter out resharding events that aren't related to the namespace being watched by a changeStream
Branch: master
https://github.com/mongodb/mongo/commit/a6593ef1b2671c3ea126097bac3b9b6ab2138c2d

Comment by Bernard Gorman [ 22/Mar/22 ]

cc kevin.rosendahl, oren.ovadia

Comment by Bernard Gorman [ 22/Mar/22 ]

Attached a reproduction test above. The solution to this issue is to simply add a predicate on "ns" to buildInternalOpFilter. With that predicate in place, we can change the o.shardCollection and o.migrateLastChunkFromShard predicates to simple existence tests.

Generated at Thu Feb 08 06:01:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.