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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • QO 2023-12-11, QO 2023-12-25, QO 2024-01-08, QO 2024-01-22
    • 135
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Henri Nikku
            Reporter:
            Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: