[SERVER-25676] getLastError with write concern may return early after call to createIndexes on same connection Created: 17/Aug/16  Updated: 06/Dec/22  Resolved: 19/Dec/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.2.9, 3.3.11
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Andy Schwerin Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Assigned Teams:
Sharding
Operating System: ALL
Sprint: Sharding 2016-08-29
Participants:
Linked BF Score: 0

 Description   

The code for tracking the optime of the last write operation, specifically when that operation was index creation, has a bug on mongos that is exposed when the createIndexes command was forwarded to one or more shards using a new connection. Specifically, sometimes mongos will mistakenly believe that the optime of the createIndexes operation one or more shards was (0|0), causing waits for write concern >= w:2 to return too early.



 Comments   
Comment by Sheeri Cabral (Inactive) [ 19/Dec/19 ]

Gone away as per Randolph's previous comment.

Comment by Randolph Tan [ 21/Apr/17 ]

The specific bug schwerin mentioned on the last comment should no longer happen on master. The current master code will always use the exact host name for createIndex.

Comment by Andy Schwerin [ 07/Sep/16 ]

This bug surfaces because the RunOnAllShards command framework uses DBClientRS to do targeting and execution of remote commands, and the sharding callback hooks installed there are sometimes invoked with the replica set connection string, and sometimes with the exact hostname. The best solution would be to rewrite the RunOnAllShards command framework to use the shard and host targeting frameworks developed for the 3.4 release.

Comment by Githook User [ 19/Aug/16 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}

Message: SERVER-25676 Change name of replica set in create_index_gle.js to avoid bug.

Until a proper fix for SERVER-25676 is implemented, this change will prevent
the continuous build system from encountering it. This works because the
bug only manifests when a getLastError follows a call to createIndexes on
a sharded system where the shard replica set names appear before the
individual host names in the replica set in lexicographical order.
Branch: master
https://github.com/mongodb/mongo/commit/784cc21ab3e7e44da724092178d56cec53ffab24

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