[SERVER-32259] Improve error handling for fetchTypeAndSourceURI() Created: 11/Dec/17  Updated: 30/Oct/23  Resolved: 23/Jan/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.6.3, 3.7.2

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Ian Whalen (Inactive)
Resolution: Fixed Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.6
Participants:
Linked BF Score: 0

 Description   

WiredTigerUtil::fetchTypeAndSourceURI() is using invariant(colgroupResult.isOK()) instead of invariantOK(colgroupResult). This means if the invariant ever fires, we don't know what the bad Status actually was.



 Comments   
Comment by Githook User [ 30/Jan/18 ]

Author:

{'email': 'cramaechi@me.com', 'name': 'Chibuikem Amaechi', 'username': 'cramaechi'}

Message: SERVER-32259 Update wiredtiger_util.cpp

WiredTigerUtil::fetchTypeAndSourceURI() is using
invariant(colgroupResult.isOK()) instead of
invariantOK(colgroupResult.getStatus()). This means that if the
invariant ever fires, we don't know what the bad Status actually was.

Signed-off-by: Ian Whalen <ian.whalen@gmail.com>
(cherry picked from commit c765de210434a6a49fa62c8c0602876fec628bfc)
Branch: v3.6
https://github.com/mongodb/mongo/commit/43cadf40956ddc791e7a332dc1405bb001bb05eb

Comment by Githook User [ 23/Jan/18 ]

Author:

{'name': 'Chibuikem Amaechi', 'email': 'cramaechi@me.com', 'username': 'cramaechi'}

Message: SERVER-32259 Update wiredtiger_util.cpp

WiredTigerUtil::fetchTypeAndSourceURI() is using
invariant(colgroupResult.isOK()) instead of
invariantOK(colgroupResult.getStatus()). This means that if the
invariant ever fires, we don't know what the bad Status actually was.

Signed-off-by: Ian Whalen <ian.whalen@gmail.com>
Branch: master
https://github.com/mongodb/mongo/commit/c765de210434a6a49fa62c8c0602876fec628bfc

Comment by Chibuikem Amaechi [ 16/Jan/18 ]

Great. I will open a pull request by the end of today!

Comment by Michael Cahill (Inactive) [ 16/Jan/18 ]

cramaechi, agreed, a pull request for this change would be great. Thanks!

Comment by Chibuikem Amaechi [ 29/Dec/17 ]

As mentioned above, WiredTigerUtil::fetchTypeAndSourceURI() in mongo/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp is using an overloaded legacy invariant() that, as described by its documentation, only prints the associated condition, file name, and line number when the condition fails. But if what we want is a detailed description of the status when it is bad (i.e., the error code and a description of what caused the error), we are going to have to use invariantOK() instead of invariant().

If everyone is in agreement, I will open a pull request.

Edit:
invariantOK(colgroupResult) should be changed to
invariantOK(colgroupResult.getStatus())

Best Regards,
Chibuikem Amaechi

Generated at Thu Feb 08 04:29:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.