|
Author:
{'name': 'Xiangyu Yao', 'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com'}
Message: SERVER-31616 Check return value of std::snprintf for errors
Branch: master
https://github.com/mongodb/mongo/commit/33fc9ea009d3d91fde291fc19a9770510f8b189b
|
|
std::snprintf should never fail (return -1) so I think we should just crash. Be sure to output the translated errno (errnoWithDescription()) first.
|
|
I think the correct behavior is different for each case:
- If the method returns a Status, consider returning an error and the caller can retry at their own leisure. I think that's appropriate for setting the read timestamp on oplog transactions or otherwise
- Retry a handful of times until it succeeds (would sleeping between tries help? I have no idea). If snprintf continues to fail, invarianting may be our only choice. This unfortunately may be necessary for rewinding visibility on rollback.
- Just return without calling the WT method that wants a timestamp. This may be appropriate for updating the oldest_timestamp. Missing a few updates here and there is not problematic. Not updating the oldest_timestamp for a long time would be asking for trouble. I think trying to catch that case would be out of scope for this ticket.
Thoughts milkie?
|
|
daniel.gottlieb Hey Dan, do we want to throw an exception(invariant) or output the error + skip _conn.set_timestamp() when catching the error?
|
Generated at Thu Feb 08 04:27:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.