[SERVER-9757] Returning an OK mongo::Status should be a trivial operation Created: 22/May/13  Updated: 11/Jul/16  Resolved: 23/May/13

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

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Currently, a function that returns "Status::OK" is not efficiently generated, since the call to construct the OK status is not inlined (see getOKInfo). Furthermore, since getOKInfo uses a function scoped static, the code generated for getOKInfo is suboptimal.

We should refactor Status so that its lifecycle methods are inlined, and so that we no longer require the function scoped static (and related static initializer). The easiest way to do this is to make a Status containing a null pointer mean 'OK', and only populate the error pointer if there is actual error state to return.



 Comments   
Comment by auto [ 22/May/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-9757 Move Status inlines to inline header
Branch: master
https://github.com/mongodb/mongo/commit/b7c80ec25658288217947e3d4aaf1e27826bb578

Comment by auto [ 22/May/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-9757 Improve performance of Status as a return value

  • Make OK be represented by a NULL ErrorInfo pointer, making it much faster to construct and
    return an OK Status.
  • Inline most of the trivial methods of Status, but particuarly the refcounting, so that
    returning a Status doesn't require any function calls.
  • Remove the no longer necessary machinery around statics.
Comment by auto [ 22/May/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-9757 Add perftest for Status
Branch: master
https://github.com/mongodb/mongo/commit/86d7443917a1497c9c3294e4b995872e7b85cd7e

Comment by Andrew Morrow (Inactive) [ 22/May/13 ]

Please see the comments in http://codereview.10gen.com/10590022 for details on the performance improvements queued to resolve this ticket.

Generated at Thu Feb 08 03:21:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.