[SERVER-42897] Validate base-level latches Created: 19/Aug/19  Updated: 29/Oct/23  Resolved: 20/Nov/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3.2

Type: New Feature Priority: Major - P3
Reporter: Benjamin Caimano (Inactive) Assignee: Rahul Sundararaman (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-42894 Create CodeContext type and related m... Closed
is depended on by SERVER-44155 Validate a subset of latches of all l... Closed
Duplicate
is duplicated by SERVER-42459 Implement a lock acquisition graph type Closed
Related
is related to SERVER-42892 Create set and key types for hierarch... Closed
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2019-10-07, Service Arch 2019-10-21, Service Arch 2019-11-18, Service Arch 2019-12-02
Participants:

 Description   

To validate base-level locking, we should do the following:

  • Add a Decoration to Client to store a LatchSetState struct
  • Make a Listener derived class that implements Mutex::LockListener and mutates the LatchSetState with onQuickLock()/onSlowLock() and onUnlock()
  • Modify LockListener function signatures to take a struct Mutex::Identity that holds a name, an optional SourceLocation, and a boolean isBaseLatch. All of the contents of Mutex::Identity should be constant from Mutex construction onward.
  • Change MONGO_MAKE_LATCH to construct a Mutex with a SourceLocationHolder via MONGO_SOURCE_LOCATION and isBaseLatch = false.
  • Add MONGO_MAKE_BASE_LATCH to construct a similar Mutex but with isBaseLatch = true.
  • Change a collection of base-level latches to be defined using MONGO_MAKE_BASE_LATCH. (See comments for potential locations)


 Comments   
Comment by Githook User [ 03/Mar/20 ]

Author:

{'name': 'Ben Caimano', 'email': 'ben.caimano@10gen.com'}

Message: SERVER-43945 Expose out of order latch acquisitions in serverStatus

This commit also backports:

SERVER-42897 Validate base-level latches
SERVER-44746 Fix LatchAnalyzerTest
SERVER-44155 Validate a subset of latches of all levels
SERVER-45691 Change Mutex::LockListeners to use a std::vector again
SERVER-45793 Improve mongo::Mutex contract
SERVER-45424 Track local latch::Identities when getTestCommandsEnabled()
SERVER-46041 Add DiagnosticListener/WaitListener LSAN suppressions
SERVER-46461 Make static in getDiagnosticListenerState() immortal to fix destruction order issues during shutdown
SERVER-46197 Make build flag to disable diagnostic latches
SERVER-45276 Release lock before destroying DBClientBases
Branch: v4.2
https://github.com/mongodb/mongo/commit/24b6ee2dd48e3f1cfde1c4d7e2b01bd73921fbad

Comment by Githook User [ 20/Nov/19 ]

Author:

{'email': 'benety@mongodb.com', 'name': 'Benety Goh', 'username': 'benety'}

Message: Revert "SERVER-42897 fix test"

This reverts commit 69fb4bd8c149fc814cf0e9a37ca14b4391062a54.
Branch: master
https://github.com/mongodb/mongo/commit/381c2cd0cc1efa2e67d1321be54489ae59af844f

Comment by Githook User [ 20/Nov/19 ]

Author:

{'email': 'benety@mongodb.com', 'name': 'Benety Goh', 'username': 'benety'}

Message: SERVER-42897 fix test
Branch: master
https://github.com/mongodb/mongo/commit/69fb4bd8c149fc814cf0e9a37ca14b4391062a54

Comment by Githook User [ 19/Nov/19 ]

Author:

{'name': 'Rahul Sundararaman', 'email': 'rahul.sundararaman@mongodb.com'}

Message: SERVER-42897 Validate base-level latches
Branch: master
https://github.com/mongodb/mongo/commit/ebbc4ed166c5f5aec7700e44b47b1c5879917c61

Comment by Benjamin Caimano (Inactive) [ 22/Oct/19 ]

Base level latches likely include the following (line numbers approximate):

Show all

src/mongo/client/connpool.h:395
src/mongo/client/dbclient_connection.h:296
src/mongo/db/catalog/collection.h:139
src/mongo/db/catalog/multi_index_block.h:347
src/mongo/db/concurrency/lock_state.h:78
src/mongo/db/index/index_build_interceptor.h:160
src/mongo/db/logical_session_cache_impl.h:112
src/mongo/db/operation_time_tracker.h:60
src/mongo/db/periodic_runner_job_abort_expired_transactions.h:58
src/mongo/db/periodic_runner_job_decrease_snapshot_cache_pressure.h:62
src/mongo/db/repl/drop_pending_collection_reaper.h:129
src/mongo/db/repl/noop_writer.h:78
src/mongo/db/repl/oplog_applier.h:247
src/mongo/db/repl/replication_coordinator_impl.h:568
src/mongo/db/repl/replication_metrics.h:74
src/mongo/db/repl/rollback_checker.h:122
src/mongo/db/repl/sync_tail.h:266
src/mongo/db/repl/task_runner.h:154
src/mongo/db/s/active_migrations_registry.h:155
src/mongo/db/s/active_shard_collection_registry.h:111
src/mongo/db/s/config/namespace_serializer.h:75
src/mongo/db/s/migration_chunk_cloner_source_legacy.h:329
src/mongo/db/s/session_catalog_migration_source.h:251
src/mongo/db/s/sharding_state.h:139
src/mongo/db/service_liaison_mongod.h:72
src/mongo/db/service_liaison_mongos.h:72
src/mongo/db/session_catalog.h:156
src/mongo/db/session_killer.h:134
src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h:439
src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.h:98
src/mongo/db/time_proof_service.h:93
src/mongo/s/client/shard_remote.h:136
src/mongo/transport/service_entry_point_impl.h:84
src/mongo/transport/transport_layer_asio.h:163

Of these, I believe that these can be changed over with only Service Arch approval:

Show all

src/mongo/client/connpool.h:395
src/mongo/client/dbclient_connection.h:296
src/mongo/db/concurrency/lock_state.h:78
src/mongo/db/logical_session_cache_impl.h:112
src/mongo/db/periodic_runner_job_abort_expired_transactions.h:58
src/mongo/db/periodic_runner_job_decrease_snapshot_cache_pressure.h:62
src/mongo/db/service_liaison_mongod.h:72
src/mongo/db/service_liaison_mongos.h:72
src/mongo/db/session_catalog.h:156
src/mongo/db/session_killer.h:134
src/mongo/transport/service_entry_point_impl.h:84
src/mongo/transport/transport_layer_asio.h:163

Generated at Thu Feb 08 05:01:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.