The ENSURE_SORTED stage is a PlanStage that drops results that are not in sorted order. I believe we only add this node when the server receives an OP_QUERY with an nToReturn specified on a sorted OR query.
The tests linked here all fail because SBE doesn't support ENSURE_SORTED. One possible solution would be to detect these types of plans earlier, and fall back to the classic engine if possible.
[js_test:merge_chunks_test] uncaught exception: Error: error: { [js_test:merge_chunks_test] "$err" : "Encountered non-retryable error during query :: caused by :: Unsupported QSN in SBE stage builder: ENSURE_SORTED\n---pattern = { time: -1.0 }\n---nodeId = 6\n---fetched = 1\n---sortedByDiskLoc = 0\n---providedSorts = {baseSortPattern: {}, ignoredFields: []}\n---Child:\n------OR\n---------nodeId = 5\n---------fetched = 1\n---------sortedByDiskLoc = 0\n---------providedSorts = {baseSortPattern: {}, ignoredFields: []}\n---------Child 0:\n------------SORT\n---------------type = DEFAULT\n---------------pattern = { time: -1.0 }\n---------------limit = 5\n---------------nodeId = 2\n---------------fetched = 1\n---------------sortedByDiskLoc = 0\n---------------providedSorts = {baseSortPattern: {}, ignoredFields: []}\n---------------Child:\n------------------COLLSCAN\n---------------------ns = config.actionlog\n---------------------filter = what $eq \"balancer.round\"\n---------------------nodeId = 1\n---------------------fetched = 1\n---------------------sortedByDiskLoc = 0\n---------------------providedSorts = {baseSortPattern: {}, ignoredFields: []}\n\n---------Child 1:\n------------SORT\n---------------type = DEFAULT\n---------------pattern = { time: -1.0 }\n---------------limit = 0\n---------------nodeId = 4\n---------------fetched = 1\n---------------sortedByDiskLoc = 0\n---------------providedSorts = {baseSortPattern: {}, ignoredFields: []}\n---------------Child:\n------------------COLLSCAN\n---------------------ns = config.actionlog\n---------------------filter = what $eq \"balancer.round\"\n---------------------nodeId = 3\n---------------------fetched = 1\n---------------------sortedByDiskLoc = 0\n---------------------providedSorts = {baseSortPattern: {}, ignoredFields: []}\n\n", [js_test:merge_chunks_test] "code" : 4822884 [js_test:merge_chunks_test] } :
List of tests failing in the sharding_op_query suite:
- is depended on by
-
SERVER-56117 Enable sharding_auth_audit suite against SBE build variant
- Closed
- is related to
-
SERVER-56048 [SBE][unittest] db_s_shard_server_test fails due to unsupported QuerySolutionNode in stage builder
- Closed