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

Guard against SBE double-pushdown

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.1
    • Affects Version/s: 8.1.0-rc0, 8.0.0-rc16
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0
    • Hide

      1) Make a file "jstests/aggregation/sources/project/repro.js":

      const coll = db.repro;
      coll.drop();
      coll.createIndex({_id: 1, b: 1, a: 1});
      coll.insert([{_id:0, b:2, a:1}, {_id:1, b:2, a:1}, {_id:2, b:2, a:1}]);
      let results = coll.aggregate([{$addFields: {a: '$b'}}, {$sort: {a: 1}}],
                                   {hint: {_id: 1, b: 1, a: 1}});
      results = results.toArray().filter(x => x._id == 1);
      assert.docEq(results[0], {_id: 1, b: 2, a: 2});
      

      2) Run the following command:

      > python3 buildscripts/resmoke.py run --suites=cursor_hints_to_query_settings_sharded_collections_passthrough --mongodSetParameters='{featureFlagSbeFull: true}' jstests/aggregation/sources/project/repro.js

      3) The test will fail with the following error:

      Error: expected document { "_id" : 1, "b" : 2, "a" : 1 } and actual document { "_id" : 1, "b" : 2, "a" : 2 } are not equal
      Show
      1) Make a file "jstests/aggregation/sources/project/repro.js": const coll = db.repro; coll.drop(); coll.createIndex({_id: 1, b: 1, a: 1}); coll.insert([{_id:0, b:2, a:1}, {_id:1, b:2, a:1}, {_id:2, b:2, a:1}]); let results = coll.aggregate([{$addFields: {a: '$b'}}, {$sort: {a: 1}}], {hint: {_id: 1, b: 1, a: 1}}); results = results.toArray().filter(x => x._id == 1); assert.docEq(results[0], {_id: 1, b: 2, a: 2}); 2) Run the following command: > python3 buildscripts/resmoke.py run --suites=cursor_hints_to_query_settings_sharded_collections_passthrough --mongodSetParameters='{featureFlagSbeFull: true}' jstests/aggregation/sources/project/repro.js 3) The test will fail with the following error: Error: expected document { "_id" : 1, "b" : 2, "a" : 1 } and actual document { "_id" : 1, "b" : 2, "a" : 2 } are not equal
    • QE 2024-08-05, QE 2024-08-19, QE 2024-09-02, QE 2024-09-16

      When writing a test, I observed a query that was producing incorrect results.

      The "Steps To Reproduce" section describes how to reproduce the bug I observed.

      The bug happens when running under the "cursor_hints_to_query_settings_sharded_collections" passthrough with featureFlagSbeFull=true.

      It seems like some stages in the pipeline either are being skipped or are being erroneously optimized away.

      It's not clear if this is a bug with how QuerySettings and featureFlagSbeFull interact, or if it's a bug or limitation with the "cursor_hints_to_query_settings_sharded_collections" passthrough, or if it's bug in some other component unrelated to QuerySettings.

      The goal of this task is to investigate and see if we can come up with a minimal repro for the bug that doesn't require using the "cursor_hints_to_query_settings_sharded_collections" passthrough.

            Assignee:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: