[SERVER-60948] Insert document in new collection in migration_id_index.js to await successful index build on secondary Created: 22/Oct/21  Updated: 29/Oct/23  Resolved: 25/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.11, 5.0.4, 5.1.0-rc2, 5.1.0-rc3

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

Issue Links:
Backports
Depends
Related
related to SERVER-61837 [v4.4] Ensure waiting for majority wr... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0, v4.4
Sprint: Repl 2021-11-01
Participants:
Linked BF Score: 39

 Description   

In migration_id_index.js, we create an empty collection and then attempt to migrate it from shard 0 to shard 1. We then verify the _id index is built on both shard1 primary and secondary.

When building an index, the replica set primary will wait until all voting members have successfully built the index before committing it (two-phase index build). However, for empty collections, we have an optimization where we don't wait for the _id index to be built. Instead, we rely on the createIndex command to be propagated via the oplog.

As a result, in the test, we don't wait for the index to be built on the secondary node before we attempt to verify it exists (even with majority write concern). We should simply insert a document into the collection at the beginning of the test, so that the index build is two-phase.



 Comments   
Comment by Githook User [ 03/Nov/21 ]

Author:

{'name': 'ali-mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-60948 Insert document in new collection in migration_id_index.js to await successful index build on secondary

(cherry picked from commit 3c4e656176c73f1510531d23b59ee58acba3b492)
Branch: v4.4
https://github.com/mongodb/mongo/commit/b82405144de2560a4e764a3b1cf04f73863a18f8

Comment by Githook User [ 02/Nov/21 ]

Author:

{'name': 'ali-mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-60948 Insert document in new collection in migration_id_index.js to await successful index build on secondary

(cherry picked from commit 3c4e656176c73f1510531d23b59ee58acba3b492)
Branch: v5.0
https://github.com/mongodb/mongo/commit/6c45171b1bb84c272b6c7edd1e47c77db904e9f5

Comment by Githook User [ 02/Nov/21 ]

Author:

{'name': 'ali-mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-60948 Insert document in new collection in migration_id_index.js to await successful index build on secondary

(cherry picked from commit 3c4e656176c73f1510531d23b59ee58acba3b492)
Branch: v5.1
https://github.com/mongodb/mongo/commit/6dbb7b17909ffd00a54c0e762b6ddfc785e64ba1

Comment by Githook User [ 25/Oct/21 ]

Author:

{'name': 'ali-mir', 'email': 'ali.mir@mongodb.com', 'username': 'ali-mir'}

Message: SERVER-60948 Insert document in new collection in migration_id_index.js to await successful index build on secondary
Branch: master
https://github.com/mongodb/mongo/commit/3c4e656176c73f1510531d23b59ee58acba3b492

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