| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
| |
CollectionCatalog::get().lookupCollectionByNamespace()
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Remove leading comments that are just stating the filename.
Move any file-level comments below the copyright banner.
Remove leading blank lines.
|
|
|
|
| |
holding locks
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
| |
|
|
|
|
| |
operations
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This reverts commit 6bbaee174447ee1c9177c72bdd07f050ab07e901.
|
| |
|
|
|
|
|
|
|
| |
cc().makeOperationContext().
Also, make OperationContextImpl's constructor private so that it can only be
constructed via a Client.
|
|
|
|
|
|
| |
with cc().makeOperationContext()."
This reverts commit 0ab34aa7b9c3c48ea6cf17888620fca455284d35.
|
|
|
|
|
|
|
| |
cc().makeOperationContext().
Also, make OperationContextImpl's constructor private so that it can
only be constructed via a Client.
|
| |
|
| |
|
|
|
|
|
| |
The new file is mongo/db/db_raii.h. Also, Client::Context is now OldClientContext and
Client::WriteContext is OldClientWriteContext.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Temporarily disable collection locking for MMAPv1.
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
DBDirectClient::count
|
|
|
|
|
|
|
|
| |
This reverts commit 8e83e72512fcb8eb8f06987927766c0b77cea23e.
This reinstates commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290
and commit 962f959a09b63aa0482d7e0c9bad89363d1e1194, and fixes
three cases where the wrong database name was locked.
|
|
|
|
|
| |
This reverts commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290.
This reverts commit 962f959a09b63aa0482d7e0c9bad89363d1e1194.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This will make it possible to implement two-phase locking.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This reverts commit e1f5a39b1b625d04752be13f39c774e579b64cd8.
|
|
|
|
|
|
|
| |
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.
|