facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.46k stars 711 forks source link

Remove rdb_sysvars_mutex #1459

Closed laurynas-biveinis closed 3 weeks ago

laurynas-biveinis commented 1 month ago

The mutex is used by sysvar update functions and synchronizes updates to a subset of global system variables. But sysvar update functions are called with LOCK_global_system_variables server lock taken, making the extra locking in the SE redundant, thus just remove it.

However it was also partially (writes but not reads) protecting concurrent accesses to properties_collector_factory variable, thus introduce synchronization for its class Rdb_tbl_prop_coll_factory by adding an rwlock.

At the same time convert Rdb_tbl_prop_coll_factory pointer fields to const references, remove redundant explicit from two-argument constructor, add [[nodiscard]] to touched methods, make the class non-movable. Remove redundant const from passed by-value arguments.

To enable converting m_ddl_manager field to a const reference, mark Rdb_ddl_manager::m_rwlock field as mutable, which then enables marking many logically-const methods as such. Also mark touched methods [[nodiscard]], remove redundant const from passed by-value arguments, convert pass by const reference to pass by value for a small object arguments of GL_INDEX_ID type.

Add return value handling for one call site of Rdb_ddl_manager::find_indexes as pointed out by [[nodiscard]].

laurynas-biveinis commented 1 month ago

rdb_sysvars_mutex was renamed from pause_background_mutex by 3c19c3d7aae542508d59fc34e01a9dfe5be8a43c pause_background_mutex introduced by c5acee2651a1

laurynas-biveinis commented 1 month ago

No sysvar check function was taking this mutex.

facebook-github-bot commented 3 weeks ago

@hermanlee has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 weeks ago

This pull request has been merged in facebook/mysql-5.6@81fc0cc12992524645757021e99a33d51b7311a3.