[SERVER-31249] getLastError should not be affected by no-op retries Created: 25/Sep/17  Updated: 06/Dec/22  Resolved: 09/Nov/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.5.13
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Jack Mulrow Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Fix Votes: 0
Labels: todo_in_code
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-43483 Remove TODOs listed for SERVER-31249 Closed
Assigned Teams:
Sharding
Participants:

 Description   

The n and upserted fields (maybe more) in the getLastError command response are reset by no-op retries of retryable write commands. Since the retries are logically tied to the original successful commands, they probably shouldn't affect the output of getLastError.

Failing retryable_writes_jscore_passthrough tests:

  • bulk_legacy_enfore_gle.js


 Comments   
Comment by Githook User [ 27/May/20 ]

Author:

{'name': 'Lamont Nelson', 'email': 'lamont.nelson@Lamonts-MBP.fios-router.home'}

Message: SERVER-43483: Remove TODOs listed for SERVER-31249
Branch: master
https://github.com/mongodb/mongo/commit/5d4fa084c332dc996edd5a7060188d926e56653e

Comment by Kaloian Manassiev [ 09/Oct/17 ]

In this case, getLastError after write commands is indeed something that we support and this is a legitimate bug. I am fine with blacklisting this test for now, but I am reopening the ticket so we keep track of this omission of functionality in retryable writes.

Since getLastError is something we are contemplating to deprecate I am putting this ticket on the backlog.

Comment by Jack Mulrow [ 09/Oct/17 ]

kaloian.manassiev The test which is failing doesn't explicitly call legacy writes, it looks like it runs normal bulk operations then checks that they update getLastError as if they were legacy writes. The override used in the retryable passthrough only affects writes run through Mongo.prototype.runCommand, so it already doesn't retry legacy writes, which go through MongoBase::Functions::{insert,update,remove} instead, so if we're not going to change the behavior, I think we can just the test blacklisted.

Comment by Kaloian Manassiev [ 06/Oct/17 ]

getLastError is used for legacy writes, which are not retryable so there is no need to fix up the returned values.

jack.mulrow, is it possible to make the retryiability suite through which you found this issue not retry legacy writes?

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