diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-18 23:22:02 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-18 23:46:57 -0400 |
commit | 9abef6f25aadfd04309cb2219068097f93dc961d (patch) | |
tree | f88c7f183f201813f363d5d68c1a4a76781ca7ef /src/mongo/dbtests/query_stage_count.cpp | |
parent | a5f0a84c79b6ce41fef33da920c62be0ecc8f07b (diff) | |
download | mongo-9abef6f25aadfd04309cb2219068097f93dc961d.tar.gz |
SERVER-27244 Status usage compile-time facilities.
There are numerous places in the codebase where `mongo::Status` or
`mongo::StatusWith< T >` objects are returned and never checked.
Many of these are innocuous, but many of them are potentially
severe bugs. This change introduces facilities to permit
compile-time warning of unchecked `Status` and `StatusWith` usage
on clang compilers. It introduces an `ignore` function which is
useful to state that a specific "ignored status" case was
intentional. It not presently an error, in clang builds, to
forget to check a `Status` -- this will come in a later commit.
This also introduces a `transitional_ignore` function, which allows
for easy continual auditing of the codebase for current "whitelisted"
unchecked-status instances. All present "ignored status" cases
have been marked `transitional_ignore`.
Diffstat (limited to 'src/mongo/dbtests/query_stage_count.cpp')
-rw-r--r-- | src/mongo/dbtests/query_stage_count.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index c202c8308c6..3ff097f8cc8 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -64,17 +64,18 @@ public: virtual void setup() { WriteUnitOfWork wunit(&_opCtx); - _ctx.db()->dropCollection(&_opCtx, ns()); + _ctx.db()->dropCollection(&_opCtx, ns()).transitional_ignore(); _coll = _ctx.db()->createCollection(&_opCtx, ns()); - _coll->getIndexCatalog()->createIndexOnEmptyCollection(&_opCtx, - BSON("key" << BSON("x" << 1) - << "name" - << "x_1" - << "ns" - << ns() - << "v" - << 1)); + _coll->getIndexCatalog() + ->createIndexOnEmptyCollection(&_opCtx, + BSON("key" << BSON("x" << 1) << "name" + << "x_1" + << "ns" + << ns() + << "v" + << 1)) + .status_with_transitional_ignore(); for (int i = 0; i < kDocuments; i++) { insert(BSON(GENOID << "x" << i)); @@ -107,7 +108,7 @@ public: void insert(const BSONObj& doc) { WriteUnitOfWork wunit(&_opCtx); OpDebug* const nullOpDebug = nullptr; - _coll->insertDocument(&_opCtx, doc, nullOpDebug, false); + _coll->insertDocument(&_opCtx, doc, nullOpDebug, false).transitional_ignore(); wunit.commit(); } @@ -123,14 +124,16 @@ public: BSONObj oldDoc = _coll->getRecordStore()->dataFor(&_opCtx, oldrecordId).releaseToBson(); OplogUpdateEntryArgs args; args.nss = _coll->ns(); - _coll->updateDocument(&_opCtx, - oldrecordId, - Snapshotted<BSONObj>(_opCtx.recoveryUnit()->getSnapshotId(), oldDoc), - newDoc, - false, - true, - NULL, - &args); + _coll + ->updateDocument(&_opCtx, + oldrecordId, + Snapshotted<BSONObj>(_opCtx.recoveryUnit()->getSnapshotId(), oldDoc), + newDoc, + false, + true, + NULL, + &args) + .status_with_transitional_ignore(); wunit.commit(); } |