Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-83119

Secondary replica crashes on clustered collection if notablescan is enabled

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.1, 7.3.0-rc0, 7.0.6, 6.0.14
    • Affects Version/s: 5.3.0, 5.0.0, 6.0.0, 7.0.0, 7.2.0-rc0
    • Component/s: None
    • Labels:
    • Query Optimization
    • Fully Compatible
    • ALL
    • v7.2, v7.0, v6.0, v5.0
    • QO 2023-12-11, QO 2023-12-25, QO 2024-01-08, QO 2024-01-22
    • 145

      On a clustered collection when notablescan is enabled:

      • Query to delete multiple documents using a secondary index on the primary.  Eg., db.coll.remove({x:{$gte:0}}), where an index is defined for the field x.
      • We replicate oplog entries to delete documents on the secondary replica by _id
      • On the secondary, the deletion is not done by the indexed field x but by _id.  However, the query system doesn't recognize the clustered index as a real _id index, and it fails. This causes a crash of the secondary replica.

      In this scenario, the plan for the delete by _id on the secondary would include a CLUSTERED_IXSCAN and thus should not be blocked by the notablescan setting.

      The solution is to fix the planner logic to allow CLUSTERED_IXSCAN with the notablescan setting.

      See the repro script in the comment below and see the code here

            peter.volk@mongodb.com Peter Volk
            louis.williams@mongodb.com Louis Williams
            0 Vote for this issue
            15 Start watching this issue