summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/counttests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SERVER-52877 Unify how writable Collections instances are handledHenrik Edin2022-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | CollectionCatalog::LifetimeMode has been removed. Catalog writes now require that we are in an active WUOW. Make it allowed to use WriteUnitOfWork when the server is in readOnly mode. It does not open storage sessions, just allows registration of RecoveryUnit callbacks that are executed when calling commit(). This allows for the unification of code where we need to initialize Collection instances even in readOnly mode. Handling of enforcing readOnly has been pushed down to the RecordStore. All interfaces that perform write now check if we are in readOnly mode and throw if we are. Catalog updates using the BatchedCollectionCatalogWriter class bypass the Collection cloning if the batched CollectionCatalog instance already has a uniquely owned copy (a previous write to this collection has been requested). It is also not required to be in an active WUOW when the BatchedCollectionCatalogWriter is used.
* SERVER-56002 SERVER-56023 Store Collection metadata in the Collection and ↵Henrik Edin2021-05-201-1/+2
| | | | | | | | | | | reply on the copy-on-write machinery to keep it in sync with the durable catalog. All updates to the metadata needs to happen through the Collection, moved interfaces from the DurableCatalog to the Collection. Removed back pointer to Collection in IndexCatalogEntryImpl, interfaces now correctly take a const or non-const Collection. This should make its iterface const-correct to avoid making bugs where the copy-on-write system for Collections are bypassed. Multikey handle is special as it needs to happen without exclusive access to the Collection. Implemented isolation for the Collection metadata when multikey is changed. It handles multi-doc transactions and is only commited to the Collection instance after the write to the durable catalog successfully commits. listCollections and listIndexes can now safetly read the metadata cache without needing to read from the durable catalog making them safe to do without Collection level locks.
* SERVER-52556 Versioned CollectionCatalog. Writes are performed using ↵Henrik Edin2020-11-131-1/+1
| | | | | | | copy-on-write. Internal mutexes when reading CollectionCatalog are removed, just one mutex for writes are needed. Lock-free reads helper AutoGetCollectionForReadLockFree stashes a CollectionCatalog consistent with snapshot on OperationContext
* SERVER-50984 Add CollectionPtr to replace usage of const Collection*Henrik Edin2020-09-261-1/+1
| | | | | | | | | | | | It implements a yieldable interface that is used to re-load the Collection pointer from the catalog after a yield that released locks. With lock-free reads and copy-on-write on Collection instances releasing locks without notifying an AutoGetCollection at a higher level may cause its pointers to dangle if a MODE_X writer installs a new Collection instance in the catalog. CollectionPtr should be passed by const reference so a yield can notify all the way up.
* SERVER-50349 Getting a writable collection now requires the caller to be ↵Henrik Edin2020-09-151-7/+9
| | | | | | | | | | | | | inside a WUOW by default There are three modes when accessing a writable Collection: * Managed in WUOW (default) * Unmanaged (users need to commit/rollback) * Inplace that provides direct access to the Collection in the catalog. (Users need to ensure there's no concurrent operations going on) Added a helper RAII type CollectionWriter that abstract the three modes above and also provides abstraction on different methods of accessing Collections (AutoGetCollection or manual lookups). Writable Collection is aquired lazily when needed (usually inside a WUOW).
* SERVER-50317 Const correct uses of CollectionHenrik Edin2020-09-021-1/+2
| | | | | | Most of the code should only need a const Collection now. AutoGetCollection returns a const Collection by default. There is a placeholder getWritableCollection() interface that will handle the necessary steps we need for lock free reads in the future. Added some operators to AutoGetCollection so it behaves more like a smart pointer.
* SERVER-43859: Take MODE_IX locks for collection creation.Daniel Gottlieb2019-11-261-1/+2
| | | | | | | | | | | | | | | | | Two concurrent storage transactions can now create collections with the same collection name. These transactions will conflict at commit time; the first committer will win and register their collection into the global catalog. The losing transactions will bubble a WriteConflictException. Top-level callers that should fail if the collection already existed must now check and fail with a NamespaceExists error code. Previously, those callers could rely on lower level code returning the NamespaceExists error. Callers that were implicitly creating a collection may retry the operation, using the now-registered collection. These transaction-local collections (UncommittedCollections) are returned when doing any CollectionCatalog::lookup* call.
* SERVER-43273 Add UUID support to count and getIndexSpecs in DBClientVesselina Ratcheva2019-10-071-4/+4
|
* SERVER-43367 unittest framework refactor/fixesBilly Donahue2019-10-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Segregate old-style dbtests into their own Suite initialization system: OldStyleSuiteSpecification. This is where the funky deprecated features can live on without interfering with the Suite API. It also gives us a searchable base class to identify them in the future. OldStyleSuite has `setupTests()` and an `add<T>()` that Suite does not have. Suite API can shrink when it doesn't have to support these dbtest adaptor features. Suite only needs non-template `add(name, callback)`. - Add OldStyleSuiteInitializer to some dbtests that were missing it! These didn't use SuiteInstance to register themselves and were incorrect. They would self register, resulting in _allSuites() holding a std::shared_ptr to a static-duration Suite object! - Change `getSuite()` to return `Suite&` instead of `Suite*`. - No more "self-registering" in Suite constructor. Registration must be done as a separate post-construction step. This removes some unusual lifetime management code and is easier to document. Suite::getSuite(name) is the only way to make a Suite, and it does the make_shared and registration calls with a pseudo-private ConstructorEnable idiom. - Suite->run() returns std::unique_ptr<Result> instead of raw `Result*`. It's virtual to support OldStyleSuite behavior. - Suite._ran does nothing. Removed. - Result.cur does nothing. Removed. - Switch to pass-by-value and std::move for most ctor args. - Add explicit on 1-arg ctors. - Get rid of TestHolder. It's just a 2-field struct. - use fmt instead of snprintf - TEST and TEST_F macros: generate TEST_TYPE once. - TEST and TEST_F macros: inline the _agent variable. - Mark _doRun as `override`. - Terminology: replace CASE_NAME with SUITE_NAME. - rename DeathTestImpl -> DeathTestBase - move getDeathTestPattern into the test as a static member function - refactor out some repetition from the comparator decl macros - use if-constexpr and diamond relops to clean up the ComparisonAssertion class. - dbtests: conditionally skip some add<T> calls - further dedup (DEATH_)TEST(_F) macros
* SERVER-41496 Remove Database::getCollection() and replace with ↵Evgeni Dobranov2019-09-301-1/+1
| | | | CollectionCatalog::get().lookupCollectionByNamespace()
* SERVER-41696 Remove the 'ns' field from index specsGregory Wlodarek2019-07-291-1/+1
|
* SERVER-41772 Apply clang-format 7.0.1 to the codebaseclang-format-7.0.12019-07-271-6/+3
|
* SERVER-40724 Change namespace arguments to use NamespaceStringGeert Bosch2019-04-261-4/+8
|
* SERVER-39560 - remove leading blank line on all C++ filesBilly Donahue2019-02-131-1/+0
| | | | | | Remove leading comments that are just stating the filename. Move any file-level comments below the copyright banner. Remove leading blank lines.
* SERVER-37643 fix dbtests to avoid creating indexes using DBClient while ↵Benety Goh2019-01-241-4/+13
| | | | holding locks
* SERVER-30815 Remove the mongodmain libraryAndrew Morrow2018-11-271-1/+0
|
* SERVER-37651 Update header files with new licenseRamon Fernandez2018-10-221-14/+16
|
* SERVER-28912 Thread statement id from batched insert command oplog entryRandolph Tan2017-07-121-2/+4
|
* SERVER-27244 Status usage compile-time facilities.ADAM David Alan Martin2017-06-181-3/+3
| | | | | | | | | | | | | | | | | 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`.
* SERVER-28543 Add OperationContext as an argument to getCollectionMaria van Keulen2017-04-061-1/+1
|
* SERVER-27691 Make OperationContext::setKillAllOperations interrupt all ↵Kaloian Manassiev2017-04-051-22/+4
| | | | operations
* SERVER-22541 Refactor RAII locking helpers.Charlie Swanson2017-03-151-5/+3
| | | | | | | | | Removes the class 'ScopedTransaction' and moves the responsibility of abandoning the snapshot onto the GlobalLock class. Also renames the AutoGetCollectionForRead class to AutoGetCollectionForReadCommand, and adds a new AutoGetCollectionForRead class. Unlike AutoGetCollectionForReadCommand, this new class will not update the namespace on the CurrentOp object, nor will it add an entry to Top.
* SERVER-27938 Rename all OperationContext variables to opCtxMaria van Keulen2017-03-071-14/+14
| | | | | | This commit is an automated rename of all whole word instances of txn, _txn, and txnPtr to opCtx, _opCtx, and opCtxPtr, respectively in all .cpp and .h files in src/mongo.
* SERVER-24033 Write full index spec in oplog entry for index creation.Max Hirschhorn2016-09-141-0/+6
| | | | | | | | | | | | | | | This ensures that the index version (aka the "v" field) is always present in the oplog entry when creating indexes on a 3.4 primary. We can therefore assume that if the "v" field isn't present in the corresponding oplog entry, then a v=1 index should be built. Changes MultiBlockIndex::init() to return the index specifications that were actually created. The "repairDatabase", "compact", "copydb", and "cloneCollection" commands no longer automatically upgrade the index version to the current default version. Instead, the only command that does so is the "reIndex" command.
* SERVER-23271 Add keysInserted and keysDeleted metrics for CRUD opsJames Wahlin2016-04-211-2/+3
|
* Revert "SERVER-23271 Add keysInserted and keysDeleted metrics for CRUD ops"Benety Goh2016-04-211-3/+2
| | | | This reverts commit 6bbaee174447ee1c9177c72bdd07f050ab07e901.
* SERVER-23271 Add keysInserted and keysDeleted metrics for CRUD opsJames Wahlin2016-04-211-2/+3
|
* SERVER-23779 Replace direct instantiation of OperationContextImpl with ↵Andy Schwerin2016-04-201-4/+6
| | | | | | | cc().makeOperationContext(). Also, make OperationContextImpl's constructor private so that it can only be constructed via a Client.
* Revert "SERVER-23779 Replace direct instantiation of OperationContextImpl ↵Eric Milkie2016-04-191-6/+4
| | | | | | with cc().makeOperationContext()." This reverts commit 0ab34aa7b9c3c48ea6cf17888620fca455284d35.
* SERVER-23779 Replace direct instantiation of OperationContextImpl with ↵Andy Schwerin2016-04-181-4/+6
| | | | | | | cc().makeOperationContext(). Also, make OperationContextImpl's constructor private so that it can only be constructed via a Client.
* SERVER-18579: Clang-Format - reformat code, no comment reflowMark Benvenuto2015-06-201-129/+123
|
* SERVER-18723 boost -> stdx for threadAdam Midvidy2015-06-181-2/+1
|
* SERVER-17758 Move AutoGet* and Client::*Context to their own file.Andy Schwerin2015-03-271-2/+3
| | | | | The new file is mongo/db/db_raii.h. Also, Client::Context is now OldClientContext and Client::WriteContext is OldClientWriteContext.
* SERVER-16502: make getCollection const and not require an OpContextScott Hernandez2015-01-021-1/+1
|
* SERVER-16429 Add ScopedTransactions to places which were missing itKaloian Manassiev2014-12-101-1/+7
|
* SERVER-15707 Fix leaks in C++ unit test frameworkAndrew Morrow2014-10-271-1/+3
|
* SERVER-14425 Move LockManager out of the newlm namespaceKaloian Manassiev2014-10-101-1/+1
|
* SERVER-14668: Collection level locking for update pathGeert Bosch2014-10-091-4/+4
| | | | Temporarily disable collection locking for MMAPv1.
* Revert "SERVER-14668: Replace uses of DBWrite lock with DBLock"Geert Bosch2014-10-031-5/+4
| | | | | | | | | This reverts commit da599844c97ef6d290c03e073a9bafe41c1a914e. Conflicts: src/mongo/db/repl/repl_coordinator_external_state_impl.cpp src/mongo/dbtests/counttests.cpp src/mongo/dbtests/querytests.cpp
* SERVER-13951 Clean up WUOWs in a few dbtestsMathias Stearn2014-10-011-7/+12
|
* SERVER-13522 Remove usages of runCount and replace them with ↵Kaloian Manassiev2014-10-011-68/+25
| | | | DBDirectClient::count
* SERVER-14668: Replace uses of DBWrite lock with DBLockGeert Bosch2014-09-301-2/+3
| | | | | | | | This reverts commit 8e83e72512fcb8eb8f06987927766c0b77cea23e. This reinstates commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290 and commit 962f959a09b63aa0482d7e0c9bad89363d1e1194, and fixes three cases where the wrong database name was locked.
* BF-532: Revert "SERVER-14668: Replace uses of DBWrite lock with DBLock"Geert Bosch2014-09-291-3/+2
| | | | | This reverts commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290. This reverts commit 962f959a09b63aa0482d7e0c9bad89363d1e1194.
* SERVER-14668: Replace uses of DBWrite lock with DBLockGeert Bosch2014-09-251-2/+3
| | | | | | Make the lock mode explicit as preparation to move some to intent locks, and use proper database name instead of full namespace string to lock databases.
* SERVER-13951 WUOW now takes whole OperationContext, not just RecoveryUnitMathias Stearn2014-08-131-1/+1
| | | | This will make it possible to implement two-phase locking.
* SERVER-13951 Split index building in to UnitOfWork-sized stagesMathias Stearn2014-08-131-7/+6
| | | | | | | | | | | | | | All index builds now go through the MultiIndexBuilder as its API was already close to ideal. The following tickets have also been addressed by this commit: SERVER-14710 Remove dropDups SERVER-12309 Cloner build indexes in parallel SERVER-14737 Initial sync uses bg index building SERVER-9135 fast index build for initial sync SERVER-2747 can't kill index in phase 2 SERVER-8917 check error code rather than assuming all errors are dups SERVER-14820 compact enforces unique while claiming not to SERVER-14746 IndexRebuilder should be foreground and fail fatally
* SERVER-14085: Start using WriteUnitOfWorkGeert Bosch2014-07-011-1/+3
|
* SERVER-13961 Add OperationContext argument to Client::ContextKaloian Manassiev2014-07-011-1/+1
| | | | | | | Time tracking and database access in Client::Context require access to the OperationContext. Adding it as argument. This is in preparation for removing LockState from Client.
* Revert "SERVER-13961 Add OperationContext argument to Client::Context"Tyler Brock2014-06-301-1/+1
| | | | This reverts commit e1f5a39b1b625d04752be13f39c774e579b64cd8.
* SERVER-13961 Add OperationContext argument to Client::ContextKaloian Manassiev2014-06-281-1/+1
| | | | | | | Time tracking and database access in Client::Context require access to the OperationContext. Adding it as argument. This is in preparation for removing LockState from Client.