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

$queue/$lookup pipeline can throw if database dropped at wrong time

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Query Optimization
    • ALL
    • QO 2023-12-11, QO 2023-12-25, QO 2024-01-08, QO 2024-01-22
    • 135

    Description

      An aggregation pipeline like

      [{$documents: [{x: 1, z: 'a\0'}, {clean: 2147483647, 'netstat': 'off'}, {x: 3, z: [1, 2, 3]}]},
       {$lookup: {from: 'test_coll', as: 'fullDocument', localField: 'x', foreignField: 'x'}}];
      

      should run on mongos if 'some_db.test_coll' does not exist, or on a shard otherwise. Currently, it will throw if someone drops the database at the wrong moment during the query execution.

      The reason for this is the deferred construction of CollectionRoutingInfo in ClusterAggregation::runAggregate().

      One possible solution would be to acquire CollectionRoutingInfo only once during query optimization and rewrite the pipeline accordingly. For instance, if we know 'some_db.test_coll' does not exist, we can remove the '$lookup' stage.

      When this is done, we should consider replacing the uassert with a tassert in runPipelineOnMongoS(), so that the fuzzer tests can discover unexpected issues.

      Attachments

        Activity

          People

            henri.nikku@mongodb.com Henri Nikku
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: