[SERVER-76264] Prevent segfaults over uninitialized OptionalRoutingTableHistory Created: 18/Apr/23  Updated: 29/Oct/23  Resolved: 04/Jul/23

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

Type: Improvement Priority: Major - P3
Reporter: Fausto Leyva (Inactive) Assignee: Pol Pinol
Resolution: Fixed Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding EMEA
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2023-07-10
Participants:
Story Points: 1

 Description   

The "OptionalRoutingTableHistory" can be a nullptr for unsharded collections inside of the ChunkManager->_rt. Could we add a more robust method of preventing callers from accidentally calling methods on an unsharded collection? Perhaps invarianting on isSharded() prior to executing the methods that require that to be true. I would prefer that over seg-faulting. 

Currently, the only safe-guard against this is a small comment in the header file:
https://github.com/10gen/mongo/blob/ff5e8a16decf26e412ed06261ec92d3bafe82a63/src/mongo/s/chunk_manager.h#L530



 Comments   
Comment by Githook User [ 04/Jul/23 ]

Author:

{'name': 'Pol Pinol Castuera', 'email': 'pol.pinol@mongodb.com', 'username': 'PolPinol'}

Message: SERVER-76264 Prevent segfaults over uninitialized OptionalRoutingTableHistory
Branch: master
https://github.com/mongodb/mongo/commit/d0d1ad1db37b8a4f2678db6e2b4a49abc13b9f43

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