summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog_raii.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SERVER-65107 Check the shard version when AutoGetCollection is instantiated ↵Antonio Fuschetto2022-04-071-5/+28
| | | | and there is neither collection nor view
* SERVER-65137 LookupCollectionForYieldRestore saves collection namespace at ↵Benety Goh2022-04-061-2/+5
| | | | construction
* SERVER-52877 Unify how writable Collections instances are handledHenrik Edin2022-04-051-46/+31
| | | | | | | | | | | | | | | | | | | | | 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-65062 Check the shard version for views when AutoGetCollection is ↵Antonio Fuschetto2022-04-011-8/+23
| | | | instantiated
* SERVER-64606 Remove TenantNamespacejannaerin2022-04-011-1/+1
|
* SERVER-64464 Check the shard version for collections when AutoGetCollection ↵Antonio Fuschetto2022-03-301-0/+2
| | | | is instantiated
* SERVER-62457 Fix AutoGetCollectionForReadCommandLock bug wherein a request ↵Dianna Hohensee2022-03-091-0/+9
| | | | can come in with an UNSHARDED shard version, AutoGet*LockFree can find sharded state and then pass the SV check as unsharded, due to concurrent activities with the lock-free read state setup
* SERVER-64038 Allow any lock mode for multi-collection locking in AutoGet* ↵Dianna Hohensee2022-03-071-6/+0
| | | | helpers; Also enable SBE $lookup to run multi-collection locking for reads inside multi-doc transactions
* SERVER-60321 Fix edge cases when setting up state for Lock-free readsHenrik Edin2022-03-041-0/+5
| | | | | | | | | | | | | | | | | | | When LFR is setup we should now always: * Open a storage snapshot * Stash the catalog * Mark the OperationContext that we are in LFR None of the three is done if we are not LFR. This fixes an edge case where the opCtx was marked as LFR when no collection was found and no snapshot or catalog was stashed. A sub op could then stash a catalog that wasn't cleaned up properly when tearing down. Anything that happened afterwords, like the profile logic, now had a stashed catalog when there should be none. Also fixed when we lock for reading on a view that we are not marking the OperationContext to be LFR as we never opened a storage snapshot or stashed the catalog.
* SERVER-57250 Merge ViewCatalog into CollectionCatalogDan Larkin-York2022-02-261-20/+9
|
* SERVER-59958 implement multi-collection support for ↵Dianna Hohensee2022-02-101-19/+5
| | | | AutoGetCollectionForRead* collection helpers
* SERVER-61987 Change DatabaseHolder's map to be keyed by TenantDatabaseNameSophia Tan2022-02-031-5/+12
|
* SERVER-53307 Make ViewCatalog globalDan Larkin-York2022-01-221-1/+1
|
* SERVER-62194 Make AutoGetCollection accept multiple namespaces to lock.Dianna Hohensee2022-01-121-69/+210
|
* SERVER-62050 Remove _opCtx from AutoGetCollectionFaustoleyva542022-01-051-19/+18
|
* SERVER-62050 Remove _opCtx from AutoGetDb and instead pass in an opCtx to ↵Faustoleyva542022-01-051-7/+7
| | | | AutoGetDb::ensureDbExists()
* SERVER-60837 Remove CollectionUUID and OptionalCollectionUUID aliasesDaniel Gómez Ferro2021-12-021-20/+18
|
* SERVER-47808 Add new registerChange overload to simplify Change codeGabriel Marks2021-11-191-56/+33
|
* SERVER-60094 Add shard version to internal writeBrett Nawrocki2021-09-211-2/+1
| | | | | | | | | | | | | ReshardingOplogApplicationRules::_applyDelete_inlock() has special logic to, upon removing a document from the temporary resharding collection, move a document from one of the other stash collections (i.e. one associated with a different donor shard) into its place. The runWithTransaction() helper does so by using AlternativeSessionRegion which will construct a separate OperationContext. The write being performed in this separate OperationContext won't have shard version attached for the temporary resharding collection like the original one had. Therefore, call initializeClientRoutingVersions() on this context to set the version.
* SERVER-57119 Changed view_catalog interface to only use NamespaceStringlukebhan2021-06-231-2/+2
| | | | | | | | | | | | | | removed places where ns.ns() is called changed stringdata to namespace string for lookup function update view catalog update view catalog test fixed test fixed create coll
* SERVER-56453 fix LocalOplogInfo namespace to match new header locationBenety Goh2021-05-141-1/+1
|
* SERVER-47123 remove AutoGetOrCreateDb classBenety Goh2021-04-301-8/+0
| | | | Use AutoGetDb (and its ensureDbExists() method) instead.
* SERVER-53963 Improve error message for unsupported operations on time-series ↵Dan Larkin-York2021-02-051-0/+8
| | | | collections
* SERVER-52835 Nested LFR lock helpers should read from copied CollectionCatalogDianna Hohensee2021-01-081-0/+2
|
* SERVER-53427 Infrastructure changes to support nested LFR operationsDianna Hohensee2020-12-181-0/+27
| | | | | | | 1) Create a nested lock helper to run lock-free if a higher level lock-free operation is already running. 2) Change LockFreeReadsBlock to use a counter rather than a boolean to accommodate out of order lock helper destructors. 3) Only yield lock-free read state in query yield when NOT recursively locked. 4) Change query stages and plan executor to use new nested lock-free lock helper.
* SERVER-51319 Call DatabaseShardingState::checkDbVersion() and ↵Dianna Hohensee2020-12-161-1/+29
| | | | | | | | | | | CSS::getCollectionDescription() safely in AutoGetCollectionLockFree and expand lock-free sharding testing. CollectionShardingState and DatabaseShardingState can now be accessed without a lock via new getSharedForLockFreeReads() functions on their respective interfaces. The shard key will now be available in the AutoGetCollection* RAII types via the CollectionPtr. This allows lock-free reads to acquire a single view of the sharding state to use throughout a read operation.
* SERVER-53057 Read-copy-update for the ViewCatalog.Henrik Edin2020-12-091-1/+1
| | | | | | | get() now returns an immutable instance. Modifications are done with static functions in the ViewCatalog that perform the update serialized by a write mutex. Const-correct usage of the ViewCatalog.
* SERVER-52930 Fix so reIndex commit the writable Collection in each WUOW.Henrik Edin2020-11-181-38/+13
| | | | Remove LifetimeMode::kUnmanagedCommitManagedRollback it was only used here and was not correct.
* SERVER-52694 Rely on Collection copy-on-write instead of restoring ↵Henrik Edin2020-11-181-21/+35
| | | | | | | Collection in rollback handler CollectionIndexUsageTrackerDecoration is separated from CollectionQueryInfo as they no longer have the same semantics. CollectionIndexUsageTrackerDecoration is shared between Collection instances and CollectionQueryInfo is not. Fix UnmanagedCommitManagedRollback mode so it works when write conflict exception is thrown by managing it for rollback
* SERVER-50870 Establish consistent storage snapshot with the refreshed ↵Henrik Edin2020-11-171-5/+8
| | | | Collection after yielding
* SERVER-52556 Versioned CollectionCatalog. Writes are performed using ↵Henrik Edin2020-11-131-24/+15
| | | | | | | 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-51807 Get point-in-time read timestamp in global lockA. Jesse Jiryu Davis2020-11-121-3/+4
|
* SERVER-51396 Add a LockFreeReadsBlock that sets a flag on the ↵Dianna Hohensee2020-11-021-3/+2
| | | | OperationContext in order to safely bypass RSTL lock invariants for lock-free reads.
* SERVER-51769 Fix ephemeralForTest's RecoveryUnit::isActive()Gregory Wlodarek2020-10-211-1/+1
|
* SERVER-51769 Fix null dereference in an invariantGregory Wlodarek2020-10-211-1/+1
|
* SERVER-47642 Ensure no active snapshot before acquiring collection X lockBrian DeLeonardis2020-10-151-1/+12
|
* SERVER-51201 CollectionPtr returned from AutoGetCollectionLockFree is yieldableHenrik Edin2020-10-151-10/+22
|
* SERVER-50677 Make a lock-free read version of AutoGetCollectionForRead and ↵Dianna Hohensee2020-10-141-2/+1
| | | | open a storage snapshot corresponding to the acquired Collection instance
* SERVER-51200 CollectionPtr in RequiresCollectionStage point to instance ↵Henrik Edin2020-10-131-11/+5
| | | | | | | | | | | owned by AutoGetCollection RequiresCollectionStage now holds a pointer to CollectionPtr owned by an AutoGetCollection. When we save and restore the executor a new CollectionPtr pointer needs to be assigned. Plan executors can no longer be created with temporary CollectionPtr instances and their interface have been changed to take pointers to avoid binding to rvalues. RequiresCollectionStage no longer loads collections from the catalog and will be in sync with the owning AutoGetCollection.
* SERVER-50145 Collection instances are modified using copy-on-writeHenrik Edin2020-10-081-8/+9
| | | | | | | | When a writable collection is requested from the catalog a cloned instance will be returned. Its lifetime is managed by default in a WriteUnitOfWork and committed into the catalog in a commit handler. In the case of a rollback the cloned and modified collection instance is simply discarded. This removes the need to setup rollback handlers to restore any state written to a collection in the case of a rollback.
* SERVER-50678 Implement lock-free version of AutoGetCollectionDianna Hohensee2020-10-081-0/+37
|
* SERVER-51091 Rearrange AutoGetCollection templating and inheritance to have ↵Dianna Hohensee2020-09-301-31/+8
| | | | separate -LFR and non-LFR (lock-free read) lock helpers.
* SERVER-50984 Add CollectionPtr to replace usage of const Collection*Henrik Edin2020-09-261-25/+48
| | | | | | | | | | | | 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-0/+150
| | | | | | | | | | | | | 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-47885 Added lookupCollectionByXXXForRead interface to the Collection ↵Henrik Edin2020-08-071-7/+22
| | | | | | | | | catalog that returns collection as shared_ptr<const Collection> AutoGetCollectionForRead and AutoGetCollectionForReadCommand now uses this and holds the shared_ptr. They return the collection as const. Const correct various places to make this possible. Moved some logic from Collection destructors to deregister from the catalog as they may now be destroyed at a later point.
* SERVER-48312 Remove support for 'supportsDocLocking = false'Gregory Wlodarek2020-08-041-5/+0
|
* SERVER-47469 Upgrade lock mode for applyOps + system.viewsCharlie Swanson2020-06-051-0/+4
|
* SERVER-45955 Make findAndModify not take database MODE_X lockGregory Noma2020-04-011-12/+17
|
* SERVER-46930: Fix AutoGetOplog for non-document-locking storage enginesLingzhi Deng2020-03-181-18/+4
|
* SERVER-45626: Introduce AutoGetOplog for consistent oplog locking rulesLingzhi Deng2020-03-131-0/+33
|