[SERVER-71375] Replace std::set<std::string> in BucketSpec and BucketUnpacker Created: 15/Nov/22  Updated: 19/Jul/23  Resolved: 19/Jul/23

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

Type: Improvement Priority: Major - P3
Reporter: Ivan Fefer Assignee: Foteini Alvanaki
Resolution: Won't Fix Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Assigned Teams:
Query Execution
Sprint: QE 2023-07-24
Participants:
Linked BF Score: 0

 Description   

Currently we use std::set<std::string> in BucketSpec and BucketUnpacker: https://github.com/mongodb/mongo/blob/8b473650c85276ab5d14526fbb466e961b1111b4/src/mongo/db/exec/timeseries/bucket_spec.h#L259

https://github.com/mongodb/mongo/blob/8b473650c85276ab5d14526fbb466e961b1111b4/src/mongo/db/exec/timeseries/bucket_unpacker.h#L244

This forces us to do some unnecessary string copying, for example, here:
https://github.com/mongodb/mongo/blob/8b473650c85276ab5d14526fbb466e961b1111b4/src/mongo/db/exec/timeseries/bucket_spec.h#L281

We should replace it with StringSet that supports heterogeneous lookup.
Important: we need to make sure order of elements is not important before we replace things, because StringSet is unordered: https://github.com/mongodb/mongo/blob/8b473650c85276ab5d14526fbb466e961b1111b4/src/mongo/util/string_map.h#L113

 

 



 Comments   
Comment by Foteini Alvanaki [ 19/Jul/23 ]

The performance evaluation of the change showed no clear performance improvement. On the contrary, it suggests that this change might cause a slight performance regression in some tests in tsbs_query_finance and tsbs_query_manual_bucketing. For that, we have decided not to merge the change.

 

Performance results

Comment by Githook User [ 14/Jul/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: Revert "SERVER-71375 Replace std::set<std::string> in BucketSpec and BucketUnpacker with StringSet that is unordered and supports heterogeneous lookup"

This reverts commit 770aa707f7f9ab373129524aafbc228669782f4f.
Branch: master
https://github.com/mongodb/mongo/commit/a52e72477dd61d2c95e8b7a965c5cd9e5f8df37f

Comment by Foteini Alvanaki [ 14/Jul/23 ]

The merge caused a BF https://evergreen.mongodb.com/task/mongodb_mongo_master_linux_debug_aubsan_compile_required_run_unittests_770aa707f7f9ab373129524aafbc228669782f4f_23_07_14_09_23_26

Comment by Githook User [ 14/Jul/23 ]

Author:

{'name': 'Foteini Alvanaki', 'email': 'foteini.alvanaki@mongodb.com', 'username': ''}

Message: SERVER-71375 Replace std::set<std::string> in BucketSpec and BucketUnpacker with StringSet that is unordered and supports heterogeneous lookup
Branch: master
https://github.com/mongodb/mongo/commit/770aa707f7f9ab373129524aafbc228669782f4f

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