summaryrefslogtreecommitdiff
path: root/src/mongo/db/session_catalog.h
Commit message (Collapse)AuthorAgeFilesLines
* SERVER-40357 expand all calls to MONGO_DISALLOW_COPYINGBilly Donahue2019-03-281-3/+4
| | | | | | | | | | | produced by: hits="$(git grep -n MONGO_DISALLOW_COPYING | cut -d: -f1 )" for f in "$hits"; do sed -i.orig ' s/^\( *\)MONGO_DISALLOW_COPYING(\(.*\));/\1\2(const \2\&) = delete;\n\1\2\& operator=(const \2\&) = delete;/; ' $f done
* SERVER-38810 Use Session's concurrency control rules instead of internal ↵Andy Schwerin2019-02-151-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mutexes in TransactionParticipant This type simplifies and clarifies concurrency control in TransactionParticipant by: (1) Removing TP's own mutexes and using the Session concurrency control rules, instead. That is, certain state is only accessible when the Session is checked out, and requires no further locking. Other state is observable either while holding the client lock or while having checked out the Session. The latter type of state is modifiable only when having checked out the session and locked the client. (2) Separating the two types of state in (1) into separate sub-structures in TransactionParticipant, to make it clear who can access what state, (3) Putting all methods formerly on TransactionParticipant onto new member classes, TransactionParticipant::Participant and TransactionParticipant::Observer. The latter can only read the observable state from (1) above, and the participant may read or modify all of the state. The two types introduced by (3) are designed to enforce proper concurrency control by limiting access of their methods to the underlying TransactionParticipant member variables. The observer type has a private o() method which its other methods are required by convention to use in order to obtain read-only access to the Observable state of the TransactionParticipant. The participant type has the o() method plus an o(WithLock) method that allows mutation of the state while holding the client lock, and a p() method which allows reading and writing of the private state with no other locks. Please see the implementation in transaction_participant.cpp for examples. It is worth noting that with this change, locking the Client is not needed often and never for long, and there is no need for separate mutexes for participant state and monitoring state.
* 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-38810 Temporarily do not hold the client lock in ObservableSession in ↵Kaloian Manassiev2019-01-111-3/+1
| | | | order to avoid deadlock
* SERVER-38810 Simplify correct usage of locking in Session/SessionCatalog.Andy Schwerin2019-01-101-48/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces two new types for gaining access to sessions in the session catalog, based on the context of the access. It leaves a third way to access sessions, which is via OperationContextSession::get(). The new types are ObservableSession and SessionToKill. With this change, a thread may access a session in one of three ways: (1) by binding the session to an OperationContext for regular use, by instantiation of OperationContextSession or MongoDOperationContextSession, as before. (2) In the callback passed to SessionCatalog::scanSessions, in which case the callback is passed an ObservableSession that represents looking at a Session while the SessionCatalog mutex is locked and while the bound OperationContext's client mutex is held, if the session is currently checked out via methods (1) or (3). (3) By calling SessionCatalog::checkOutSessionForKill, which returns a KillableSession. This is used for cleaning a session up after it is marked for kill. This patch eliminates Session::_mutex, which is no longer required, as the SessionCatalog::_mutex and the Client provide all necessary mutual exclusion for the Session type itself.
* SERVER-37923 Make chunk migration check-out the sessionKaloian Manassiev2018-12-061-59/+22
| | | | | With this change there are no callers which modify the session state without having checked it out first.
* SERVER-37665 Add interface to explicitly checkin/checkout the OpContext sessionKaloian Manassiev2018-11-161-0/+10
|
* SERVER-37665 Get rid of the 'checkOutSession' parameter of ↵Kaloian Manassiev2018-11-161-1/+1
| | | | | | | | | | | OperationContextSession This simplifies the behaviour of the class and moves all the check-out decision taking to happen in the only consumer - the endpoint. Also renames OperationContextSessionMongoD to MongoDOperationContextSession in order to be in sync with the naming nomenclature of SessionCatalog and MongoDSessionCatalog.
* SERVER-38058 Make retryable_writes_direct_write_to_config_transactions.js ↵Kaloian Manassiev2018-11-131-1/+0
| | | | expect ConflictingOperationInProgress
* Revert "SERVER-38058 Make ↵Kaloian Manassiev2018-11-131-0/+1
| | | | | | retryable_writes_direct_write_to_config_transactions.js expect ConflictingOperationInProgress" This reverts commit 2f640ed748b861a242b3ad153e821f6b459b2511.
* SERVER-38058 Make retryable_writes_direct_write_to_config_transactions.js ↵Kaloian Manassiev2018-11-131-1/+0
| | | | expect ConflictingOperationInProgress
* SERVER-37244 Make sessions killable outside of the ↵Kaloian Manassiev2018-10-311-17/+31
| | | | Session/TransactionParticipant object
* SERVER-37244 Pull the Session state management from SessionRuntimeInfo into ↵Kaloian Manassiev2018-10-301-15/+13
| | | | | | | | Session The session's check-out state is currently duplicated between SessionCatalog's internal container structure and the Session class. This change moves it all to be under Session.
* SERVER-37711 Revert commits related to lock yielding for prepared ↵Kaloian Manassiev2018-10-251-39/+0
| | | | | | | | | | | transactions on step down This change reverts the following commits: * SERVER-35870 Allow stepdown to work with prepared transactions (f96903979ac329a760e7b6f1bb5d8695d3daf2a7) * SERVER-36913 Add functionality to LockManager for repl state transitions with prepared transactions (e65ff57e108ed69c46cc0b0ccbdd675663de2469) * SERVER-35870 Allow more than one thread to block Session checkout at a time (9406af079a894bae80fbbec4703b04974bf84476) * SERVER-35870 Add functionality to prevent Session checkouts & wait for all Sessions to be checked in (c6d90316d6b694e12426274c713a4a078e004fc5)
* SERVER-37701 Make SessionUpdateTracker include the uid portion of ↵Randolph Tan2018-10-231-5/+1
| | | | LogicalSessionId when tracking
* SERVER-37651 Update header files with new licenseRamon Fernandez2018-10-221-8/+10
|
* SERVER-37244 Move MongoD-specific code out of SessionCatalogKaloian Manassiev2018-10-121-19/+9
|
* SERVER-36799 Move all transactions and retryable writes functionality from ↵Kaloian Manassiev2018-10-081-0/+1
| | | | | | | Session into TransactionParticipant This change leaves the Session class to be a plain decorable structure only used for serialization of operations on the same logical session.
* SERVER-35870 Allow more than one thread to block Session checkout at a timeSpencer T Brody2018-09-281-2/+6
|
* SERVER-35870 Add functionality to prevent Session checkouts & wait for all ↵Spencer T Brody2018-09-171-0/+37
| | | | Sessions to be checked in
* SERVER-35870 Rename SessionCatalog::_txnTable to _sessionsSpencer T Brody2018-09-171-1/+1
|
* SERVER-35900 Refactor transaction machinery out from Session classRandolph Tan2018-08-081-6/+1
|
* SERVER-34811 Forbid reads and writes to the config, admin, and local ↵Tess Avitabile2018-05-081-1/+3
| | | | databases within transactions
* SERVER-34051 Require autocommit=false on all transaction operations and add ↵William Schultz2018-04-041-1/+2
| | | | | | | | | | | support for 'startTransaction' argument This patch requires all operations that are part of a multi-statement transaction to specify an autocommit=false command argument. It also adds the 'startTransaction' command argument, which when specified as 'true' indicates that a command is the beginning of a multi-statement transaction.
* SERVER-34101 Revert change to free transaction resources on snapshot read ↵James Wahlin2018-03-281-21/+0
| | | | killCursors
* SERVER-33922 Remove nestingLevel from SessionCatalog, check for ↵Spencer T Brody2018-03-201-6/+2
| | | | DBDirectClient explicitly instead
* SERVER-33669 Stepdown and shutdown should abort all uncommitted transactionsTess Avitabile2018-03-201-16/+7
|
* SERVER-33591 Cleanup interaction of write concerns and transactionsSiyuan Zhou2018-03-151-11/+6
|
* SERVER-33672 Make killSessionsLocal() kill any matching SessionsTess Avitabile2018-03-141-0/+10
|
* SERVER-33689 killCursors on snapshot read cursor should free stashed ↵Tess Avitabile2018-03-131-4/+25
| | | | transaction resources
* SERVER-32880 Parse and add autocommit parameter to SessionPavithra Vetriselvan2018-02-211-1/+4
|
* SERVER-33223 Add transaction resource stashJames Wahlin2018-02-161-0/+12
|
* SERVER-31342 Do not remove checked-out sessions from the cache on invalidationKaloian Manassiev2017-10-181-16/+4
|
* SERVER-31114 Perform targeted session invalidation on direct writes to ↵Kaloian Manassiev2017-09-201-3/+9
| | | | `config.transactions`
* Revert "SERVER-31114 Perform targeted session invalidation on direct writes ↵Kaloian Manassiev2017-09-201-9/+3
| | | | | | to `config.transactions`" This reverts commit c8cb9cc374af47f862d81e52ad4bc33d96239ef0.
* SERVER-31114 Perform targeted session invalidation on direct writes to ↵Kaloian Manassiev2017-09-201-3/+9
| | | | `config.transactions`
* SERVER-30325 Add cache of committed statement idsKaloian Manassiev2017-09-151-3/+5
| | | | | This makes the check for whether a statement executed take O(1) time instead of O(size of the batch).
* SERVER-30912 Only check out sessions for write commandsJack Mulrow2017-09-141-1/+1
|
* SERVER-30325 Simplify session transaction state maintenanceKaloian Manassiev2017-09-131-0/+4
| | | | | | This change exposes a single 'onWriteCompleted' method on the Session object, which hides all the concurrency control and the session cache maintenance.
* SERVER-30936 Ensure operation session info is initialized only onceKaloian Manassiev2017-09-061-1/+1
|
* Revert "SERVER-30936 Ensure operation session info is initialized only once"Kaloian Manassiev2017-09-061-1/+1
| | | | This reverts commit e00c6d29996ba52b5a77a072d1c5c555f62b8534.
* SERVER-30936 Ensure operation session info is initialized only onceKaloian Manassiev2017-09-061-1/+1
|
* SERVER-30076 Use the UUID of the transactions collection for rollback via ↵Jack Mulrow2017-08-171-0/+6
| | | | refetch
* SERVER-30325 Introduce a getOrCreateSession method on the SessionCatalogKaloian Manassiev2017-08-141-14/+63
|
* SERVER-30281 Force sessions to reload after rollbackJack Mulrow2017-08-031-2/+3
|
* SERVER-30318 Allow multiple instances of OperationContextSession per ↵Randolph Tan2017-07-281-1/+3
| | | | OperationContext
* SERVER-30298 Add UserDigest LogicalSessionIDJason Carey2017-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inclusion of a sha256 digest of the full username to the logical session id (in addition to the current guid) is necessary to fully disambiguate logical sessions in degraded clusters (when the authoritative record for a session is unreachable). Semantics for the uid are as follows: session creation via startSession() * Sessions can only be created with one, and only one, user authenticated * The composite key is created from a guid created on the spot, as well as the digest of the currently auth'd username * Only the session guid is returned to the user * This prevents outside users from attempting to send back a value we'd have to check. It's preferable to decorate the guid with the user digest per command, rather than having to check a value the user might send. session use for a command * Sessions are passed via the lsid top level field in any command * Sessions are only meaningful for commands which requireAuth. For sessions which don't require auth, we strip session information from the command at parse time * Session ids are passed as an object, which can optionally include the username digest * It is illegal to pass the username digest unless the currently auth'd user has the impersonate privilege (the __system user does). This enables sessions on shard servers via mongos
* SERVER-29531 Handle rollbacks in SessionTransactionTableJack Mulrow2017-07-121-0/+11
|
* SERVER-29885 Serialize operations for the same logical sessionKaloian Manassiev2017-07-061-0/+189
Also makes the session state available on the OperationContext.