[SERVER-64055] Server-side rewrite for find command on mongod Created: 28/Feb/22  Updated: 29/Oct/23  Resolved: 31/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Davis Haupt (Inactive) Assignee: Davis Haupt (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-63293 Construct a set of binary tags given ... Closed
depends on SERVER-63294 Server-side rewrite for match express... Closed
is depended on by SERVER-63884 Support count command in server-side ... Closed
Backwards Compatibility: Fully Compatible
Sprint: QO 2022-03-07, QO 2022-04-04
Participants:

 Description   

Right after parsing the MatchExpression in CanonicalQuery,

if (gFeatureFlagFLE2.isEnabledAndIgnoreFCV() &&
        findCommand->getEncryptionInformation().has_value()) {
        // If encryptionInformation is present, there may be FLEFindPayloads to rewrite, so call the
        // FLE rewrite logic.
        auto info = findCommand->getEncryptionInformation();
        auto rewriter = fle::FLEFindRewriter(findCommand->getEncryptionInformation().get(),
                                             [](BSONElement) { return BSONObj(); });
        me = rewriter.rewriteMatchExpression(std::move(me));
    }



 Comments   
Comment by Githook User [ 31/Mar/22 ]

Author:

{'name': 'Davis Haupt', 'email': 'davis.haupt@mongodb.com', 'username': 'davish'}

Message: SERVER-64055 fle find rewrite on mongod
Branch: master
https://github.com/mongodb/mongo/commit/123d582388017c273e0939e644026bce20184739

Comment by Githook User [ 31/Mar/22 ]

Author:

{'name': 'Davis Haupt', 'email': 'davis.haupt@mongodb.com', 'username': 'davish'}

Message: SERVER-64055 e2e tests for fle find rewrite on mongod
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/3cc0e5f7661cc073ce8ac136d8c63c79adb679d7

Comment by Davis Haupt (Inactive) [ 08/Mar/22 ]

Unfortunately, there's a fundamental dependency cycle when trying to include the transaction API in the canonical_query SCons library:

build/opt/mongo/db/libtransaction_api.so =>
build/opt/mongo/db/libshared_request_handling.so => 
build/opt/mongo/db/liblogical_session_cache_impl.so => 
build/opt/mongo/db/s/libsharding_api_d.so => 
build/opt/mongo/s/libgrid.so => 
build/opt/mongo/s/libsharding_routing_table.so => 
build/opt/mongo/db/query/libquery_planner.so => 
build/opt/mongo/db/query/libcanonical_query.so => 
build/opt/mongo/db/libtransaction_api.so

Basically, the sharding machinery that the transaction API sits on top of depends on the query planner for chunk migration and shard targeting, which obviously depends on canonical_query. So sharding code can't be called from canonicalquery. This isn't a huge blocker, but it means that we'll need to call code to rewrite the CanonicalQuery from each individual command entrypoint on mongod and mongos.

Comment by Davis Haupt (Inactive) [ 28/Feb/22 ]

Added a dependency on SERVER-63293, but we may be able to mock out tag generation for integration tests.

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