[SERVER-67468] When creating filenames from random numbers, use unsigned numbers Created: 23/Jun/22  Updated: 10/Nov/23  Resolved: 07/Nov/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0, 7.2.0-rc1

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Daotang Yang
Resolution: Fixed Votes: 0
Labels: neweng, techdebt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2023-10-30, Execution Team 2023-11-13
Participants:

 Description   

There are two places where we currently create files with the pattern "-" + randomInt64(). We do this when generating idents in the catalog that are used in wiredtiger file names, and when generating filenames for the external sorter used during index building. The problem is that if the random number is negative, we end up with two adjacent dashes in the file name. At the very least we should convert the random number to uint64_t prior to stringifying. It may be better to add a nextUInt64() method to RandomBase since unconstrained random "numbers" are just bags of bits anyway, and that is usually better in a unsigned type.



 Comments   
Comment by Githook User [ 03/Nov/23 ]

Author:

{'name': 'Daotang Yang', 'email': 'daotang.yang@mongodb.com', 'username': ''}

Message: SERVER-67468 When creating filenames from random numbers, use unsigned numbers
Branch: master
https://github.com/mongodb/mongo/commit/59b50c55460fc87b10c38408601ebdcb7c70689c

Comment by Louis Williams [ 20/Oct/23 ]

daotang.yang@mongodb.com the code was moved here

Comment by Daotang Yang [ 19/Oct/23 ]

https://github.com/mongodb/mongo/blob/043545f8259aa5c0a4c2fc318ec889d96e54f1ea/src/mongo/db/storage/durable_catalog_impl.cpp#L175-L177 doesn't exist anymore in the latest codebase.

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