[SERVER-45852] Two-phase index build constraints should be checked at the completion of the index build Created: 29/Jan/20  Updated: 29/Oct/23  Resolved: 27/Feb/20

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

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:
Depends
Related
related to SERVER-45351 Newly-elected primaries can commit in... Closed
is related to SERVER-39976 Two-phase index builds on primaries s... Closed
is related to SERVER-44654 allow unique index builds to continue... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2020-03-09
Participants:
Linked BF Score: 14

 Description   

We call prepareInsertDeleteOptions once when initializing an index build, but as a resultthe GetKeysMode does not change dynamically as the replication state changes.

Consider the following sequence where node1 is primary and node2 is secondary.

  1. Insert { A: invalid}
  2. start index build on node1 (kEnforceConstraints)
  3. start index build on node2 (kRelaxConstraints)
  4. stepUp node2 to primary, node1 is secondary. node2 continues relaxing constraints, and node1 continues enforcing them
  5. update {A: valid}
  6. node2 scans A and succeeds because it has seen the update
  7. node1 scans A and fails because it hasn’t received the update yet

This would be an error because the secondary, node1, fails but the primary, node2, will commit the index build.



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

Author:

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

Message: SERVER-45852 Two-phase index build constraints are checked at the completion of the index build
Branch: master
https://github.com/mongodb/mongo/commit/686b0034d2a6b99f4cf7f27cf0bde75421e72cc9

Comment by Suganthi Mani [ 06/Feb/20 ]

After this ticket and SERVER-39976 , we guarantee there won't be any exceptions thrown for _scanCollectionAndInsertKeysIntoSorter (collection scan phase) and _insertKeysFromSideTablesWithoutBlockingWrites (first and second drain phase).

Note: As part of this ticket, we should remove this try catch block.

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