[SERVER-83826] Implement "trySbeRestricted" in terms of a new SbeCompatibility enum value Created: 01/Dec/23  Updated: 26/Jan/24  Resolved: 26/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc2

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: Adi Agrawal
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2023-12-11, QE 2023-12-25, QE 2024-01-08, QE 2024-01-22, QE 2024-02-05
Participants:
Story Points: 1

 Description   

SERVER-83470 introduces internalQueryFrameworkControl="trySbeRestrict" in a way that is simple and amenable to backport, but justin.seyster@mongodb.com proposed an improvement that we should make to it in the master branch. Logically each DocumentSource should declare its level of compatibility with SBE. At the moment there are three compatibility levels:

enum struct SbeCompatibility {
    // Not implemented in SBE.
    notCompatible,
    // Implemented in SBE but behind the featureFlagSbeFull flag.
    flagGuarded,
    // Implemented in SBE and enabled by default.
    fullyCompatible,
};

However, "trySbeRestrict" effectively introduces a fourth level. We should add a fourth enum value and rename them like so:

enum struct SbeCompatibility {
   // Not implemented in SBE.
  notCompatible,
  // Requires featureFlagSbeFull to be set. New SBE features which are under
  // development can live under this feature flag until they are ready to be shipped.
  requiresSbeFull,
  // Requires the framework control knob to be "trySbe". Fully tested, complete
  // SBE features belong here.
  default,
  // Used for the narrow feature set that we expose when "trySbeRestricted" is on.
  noRequirements,
};

In the code which decides whether a DocumentSource should be pushed down, we imagine defining a lambda function like so:

auto meetsRequirements = [&minRequiredCompatibility](SbeCompatibility stageCompatibility) {
    return stageCompatibility >= minRequiredCompatibility;
}

That way the callsites would be more readable. For instance, when asking whether a $unwind can be pushed down, you could do something like this:

meetsRequirements(SbeCompatibility::requiresSbeFull);

Unlike SERVER-83470, this ticket should not be backported.



 Comments   
Comment by Githook User [ 26/Jan/24 ]

Author:

{'name': 'Adityavardhan Agrawal', 'email': 'adi.agrawal@mongodb.com', 'username': 'Adityav369'}

Message: SERVER-83826 Implement "trySbeRestricted" in terms of a new SbeCompatibility enum value (#18075)

GitOrigin-RevId: 12cbc007fd5c9ea3611ccb887968659cb8c2a66f
Branch: master
https://github.com/mongodb/mongo/commit/4ca9e17078fd90f4fcb746832f8a8baf1b5a2f59

Generated at Thu Feb 08 06:53:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.