[SERVER-58369] Don't take ARHASH optimization path for a direct $sample stage on system.buckets collection Created: 08/Jul/21  Updated: 29/Oct/23  Resolved: 09/Jul/21

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

Type: Bug Priority: Major - P3
Reporter: Yoon Soo Kim Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query Execution 2021-07-12, Query Execution 2021-07-26
Participants:
Case:
Linked BF Score: 135

 Description   

Can repro the issue on Ubuntu 18.04.

Stack trace on Ubuntu.

...,
{
    "a":"55CBA8103185","b":"55CB9AE1E000","o":"D2E5185",
    "s":"boost::assertion_failed(char const*, char const*, char const*, long)","s ":"65"
},
{
    "a":"55CBA4D144C6","b":"55CB9AE1E000","o":"9EF64C6",
    "s":"boost::optional<mongo::BucketUnpacker>::get()","s ":"56"
},
{
    "a":"55CBA4D12405","b":"55CB9AE1E000","o":"9EF4405",
    "s":"boost::optional<mongo::BucketUnpacker>::operator*() &","s ":"15"
},
{
    "a":"55CBA4D05CBA","b":"55CB9AE1E000","o":"9EE7CBA",
    "s":"mongo::(anonymous namespace)::createRandomCursorExecutor(mongo::CollectionPtr const&, boost::intrusive_ptr<mongo::ExpressionContext> const&, long long, long long, boost::optional<mongo::BucketUnpacker>)","s ":"A0A"
},
{
    "a":"55CBA4D04B66","b":"55CB9AE1E000","o":"9EE6B66",
    "s":"mongo::PipelineD::buildInnerQueryExecutorSample(mongo::DocumentSourceSample*, mongo::DocumentSourceInternalUnpackBucket*, mongo::CollectionPtr const&, mongo::Pipeline*)","s ":"276"
},
{
    "a":"55CBA4D06655","b":"55CB9AE1E000","o":"9EE8655",
    "s":"mongo::PipelineD::buildInnerQueryExecutor(mongo::CollectionPtr const&, mongo::NamespaceString const&, mongo::AggregateCommandRequest const*, mongo::Pipeline*)","s ":"205"
},
{
    "a":"55CBA4443A50","b":"55CB9AE1E000","o":"9625A50",
    "s":"mongo::runAggregate(mongo::OperationContext*, mongo::NamespaceString const&, mongo::AggregateCommandRequest const&, mongo::LiteParsedPipeline const&, mongo::BSONObj const&, std::vector<mongo::Privilege, std::allocator<mongo::Privilege> > const&, mongo::rpc::ReplyBuilderInterface*)","s ":"1DB0"
},
{
    "a":"55CBA443AE25","b":"55CB9AE1E000","o":"961CE25",
    "s":"mongo::(anonymous namespace)::PipelineCommand::Invocation::run(mongo::OperationContext*, mongo::rpc::ReplyBuilderInterface*)","s ":"E5"
},
{
    "a":"55CBA5BB0623","b":"55CB9AE1E000","o":"AD92623",
    "s":"mongo::CommandHelpers::runCommandInvocation(mongo::OperationContext*, mongo::OpMsgRequest const&, mongo::CommandInvocation*, mongo::rpc::ReplyBuilderInterface*)","s ":"D3"
},
{
    "a":"55CBA5BB8A65","b":"55CB9AE1E000","o":"AD9AA65",
    "s":"_ZZN5mongo14CommandHelpers20runCommandInvocationESt10shared_ptrINS_23RequestExecutionContextEES1_INS_17CommandInvocationEENS_9transport15ServiceExecutor14ThreadingModelEENK3$_0clEv","s ":"35"
},

According to the above stack, we're dereferencing an empty optional.



 Comments   
Comment by Githook User [ 09/Jul/21 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-58369 Don't take ARHASH optimization path for a direct $sample stage on system.buckets collection
Branch: master
https://github.com/mongodb/mongo/commit/2ae8ceb242c3a7b69db13b8011bbdfd5d02254ef

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