[SERVER-55012] renameBetweenDBs needs to always reposition its cursor in the event of a writeConflict Created: 05/Mar/21  Updated: 29/Oct/23  Resolved: 22/Mar/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.7

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2021-03-22, Execution Team 2021-04-05
Participants:
Linked BF Score: 135

 Description   

renameBetweenDBs has WriteConflictException handling that repositions (using seekExact) the cursor on the source collection if the RecordID of the beginning of the batch does not match the last observed RecordId. This is correct in most cases, but not if the writeConflict is observed on the first document of the batch.

In this case the cursor on the source collection will invalidated, but not repositioned. Subsequent calls to next() will start over from the beginning. This can result in erroneously copying the same data from a source collection into the destination.



 Comments   
Comment by Githook User [ 10/May/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-55012 renameBetweenDBs needs to always reposition its cursor in the event of a writeConflict

(cherry picked from commit fd0d1ee222726959b7b211c614e92be903b13a54)
Branch: v4.4
https://github.com/mongodb/mongo/commit/06447e6ff8e2cad7d5729d377c0cc2c6db8de898

Comment by Githook User [ 22/Mar/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-55012 renameBetweenDBs needs to always reposition its cursor in the event of a writeConflict
Branch: master
https://github.com/mongodb/mongo/commit/fd0d1ee222726959b7b211c614e92be903b13a54

Generated at Thu Feb 08 05:35:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.