diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/dbtests/dbtests.cpp | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/dbtests/dbtests.cpp')
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index f094709d471..9ff7b31183e 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -53,56 +53,50 @@ namespace mongo { namespace dbtests { - // This specifies default dbpath for our testing framework - const std::string default_test_dbpath = "/tmp/unittest"; +// This specifies default dbpath for our testing framework +const std::string default_test_dbpath = "/tmp/unittest"; - Status createIndex(OperationContext* txn, - StringData ns, - const BSONObj& keys, - bool unique) { - BSONObjBuilder specBuilder; - specBuilder << - "name" << DBClientBase::genIndexName(keys) << - "ns" << ns << - "key" << keys; - if (unique) { - specBuilder << "unique" << true; - } - return createIndexFromSpec(txn, ns, specBuilder.done()); +Status createIndex(OperationContext* txn, StringData ns, const BSONObj& keys, bool unique) { + BSONObjBuilder specBuilder; + specBuilder << "name" << DBClientBase::genIndexName(keys) << "ns" << ns << "key" << keys; + if (unique) { + specBuilder << "unique" << true; } + return createIndexFromSpec(txn, ns, specBuilder.done()); +} - Status createIndexFromSpec(OperationContext* txn, StringData ns, const BSONObj& spec) { - AutoGetOrCreateDb autoDb(txn, nsToDatabaseSubstring(ns), MODE_X); - Collection* coll; - { - WriteUnitOfWork wunit(txn); - coll = autoDb.getDb()->getOrCreateCollection(txn, ns); - invariant(coll); - wunit.commit(); - } - MultiIndexBlock indexer(txn, coll); - Status status = indexer.init(spec); - if (status == ErrorCodes::IndexAlreadyExists) { - return Status::OK(); - } - if (!status.isOK()) { - return status; - } - status = indexer.insertAllDocumentsInCollection(); - if (!status.isOK()) { - return status; - } +Status createIndexFromSpec(OperationContext* txn, StringData ns, const BSONObj& spec) { + AutoGetOrCreateDb autoDb(txn, nsToDatabaseSubstring(ns), MODE_X); + Collection* coll; + { WriteUnitOfWork wunit(txn); - indexer.commit(); + coll = autoDb.getDb()->getOrCreateCollection(txn, ns); + invariant(coll); wunit.commit(); + } + MultiIndexBlock indexer(txn, coll); + Status status = indexer.init(spec); + if (status == ErrorCodes::IndexAlreadyExists) { return Status::OK(); } + if (!status.isOK()) { + return status; + } + status = indexer.insertAllDocumentsInCollection(); + if (!status.isOK()) { + return status; + } + WriteUnitOfWork wunit(txn); + indexer.commit(); + wunit.commit(); + return Status::OK(); +} } // namespace dbtests -} // namespace mongo +} // namespace mongo -int dbtestsMain( int argc, char** argv, char** envp ) { +int dbtestsMain(int argc, char** argv, char** envp) { static StaticObserver StaticObserver; Command::testCommandsEnabled = 1; ::mongo::setupSynchronousSignalHandlers(); |