1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Monty dd5d88bb45 Added query_cache_use_rw_lock to allow concurrent query cache lookups
The query cache protected all operations with one exclusive lock
(m_cache_lock_status, guarded by structure_guard_mutex). This
serialized every lookup, even though a lookup mainly reads the
query cache structures.

Added a new global variable, query_cache_use_rw_lock (default OFF).
When set, send_result_to_client() takes a shared (read) lock instead
of an exclusive one, which allows lookups to run concurrently. Having
it as an option makes it possible to benchmark both alternatives with
the same binary and then decide which one to keep.

Implementation:
- try_lock() has a new 'read_lock' argument. The new inline function
  try_read_lock() sets it from query_cache_use_rw_lock.
- Readers are counted in m_readers and leave m_cache_lock_status as
  UNLOCKED. Writers wait until m_readers is 0 and are counted in
  m_waiting_writers. Waiting writers have priority over new readers,
  which ensures that invalidations are not starved by cache hits.
- Readers wait on the new COND_cache_read_lock. wake_up_waiters()
  wakes one waiting writer, or all waiting readers if there is none.
- unlock() is split into unlock() and unlock_internal(). The kind of
  lock to release is deduced from m_cache_lock_status, so none of the
  unlock() callers had to be changed.
- send_result_to_client() updates the query list and the statistics
  under structure_guard_mutex when it only holds a read lock. With a
  write lock this is done as before, without taking the mutex.
- If an engine requests invalidation during a lookup done with a read
  lock, the table key is copied and the invalidation is done after
  the lock is released, as invalidation requires a write lock.
- Added the DEBUG_SYNC point "in_query_cache_hit" used by the new test.

With query_cache_use_rw_lock=0 the code works as before.

Did a simple sysbench run with 64 threads and 200000 simple select queries,
all served from query cache. query_cache_use_rw_lock=1 gave a 2.25x
speedup. The difference to an unmodied MariaDB version for the same
test is 2.3 x faster.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-09 16:48:03 +03:00
2026-09-04 12:14:15 +02:00
2026-05-22 09:52:05 +02:00
2026-09-15 11:07:31 +02:00
2026-06-15 16:53:03 +02:00
2026-09-04 12:21:02 +02:00
2026-08-12 14:31:53 +03:00
2026-06-15 16:53:03 +02:00
2026-09-04 12:21:02 +02:00
2026-08-20 08:27:14 +02:00
2026-10-09 16:48:03 +03:00
2026-08-03 13:42:39 +02:00
2026-06-15 16:53:03 +02:00
2026-07-30 11:41:55 +02:00
2026-05-22 09:52:05 +02:00
2026-07-30 11:41:55 +02:00
2026-06-15 16:53:03 +02:00
2026-07-28 13:14:38 +02:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:14:15 +02:00
…
2026-09-15 11:58:01 -04:00

MariaDB Server

MariaDB Server is one of the most widely deployed open source relational databases. It is built by a global community of contributors together with the MariaDB Foundation and MariaDB plc, and it powers workloads from small applications to large-scale production systems.

MariaDB began as a fork of MySQL, led by the original MySQL developers, and it maintains a high degree of MySQL compatibility. It has since grown into a database with its own capabilities, including native vector search, multiple pluggable storage engines, synchronous clustering, and analytical features, while remaining a straightforward migration target for existing MySQL deployments.

Key features

  • Native vector search. A built-in VECTOR data type with approximate nearest-neighbour indexing (HNSW), available since MariaDB 11.8 with no extension required.
  • Pluggable storage engines. InnoDB (default for transactional workloads), Aria, MyRocks, ColumnStore for analytics, Spider for sharding, and S3 for archival, among others.
  • Replication and clustering. Asynchronous, semi-synchronous, and parallel replication with global transaction IDs, plus Galera synchronous multi-primary clustering.
  • Advanced SQL. Common table expressions and recursive CTEs, window functions, system-versioned (temporal) tables, sequences, and a broad set of JSON functions.
  • MySQL and Oracle compatibility. Wire-protocol and syntax compatibility with MySQL, plus an Oracle SQL mode supporting PL/SQL-style stored routines.
  • Spatial and full-text search. GIS data types and functions, and built-in full-text indexing.
  • Security. Role-based access control, pluggable authentication (ed25519, PAM, GSSAPI, and more), data-at-rest encryption, and TLS for connections.

Documentation

Releases

MariaDB Server follows a yearly long-term support (LTS) model alongside quarterly rolling releases. Binary LTS releases are maintained for three years and are recommended for production; rolling releases deliver new features sooner with a shorter support window.

For the current version and full history, see Releases and the MariaDB release calendar.

Installing

Packages and installation instructions for all supported platforms are available at https://mariadb.org/download/.

Building from source

To build MariaDB from source and run the test suite, follow the developer guide

It covers building the code correctly, running the MariaDB testing framework, and choosing the right branch to target for contributions.

Contributing

Contributions are welcome, from code and documentation to bug reports and reviews. See CONTRIBUTING.md to get started, and CODING_STANDARDS.md for code style. Contributors and community members are recognised in CREDITS.

Getting help

Licensing

MariaDB Server is licensed under version 2 of the GNU General Public License (GPLv2), without the "any later version" clause. This is inherited from MySQL. License information is in the COPYING file, and third-party license information is in the THIRDPARTY file.

About MariaDB Foundation

MariaDB is brought to you by the MariaDB Foundation and MariaDB plc. The MariaDB Foundation is the custodian of the MariaDB Server codebase, ensuring it stays open and that anyone can contribute. See CREDITS for details on the Foundation and the people developing MariaDB.

MySQL, the base of MariaDB, is a product and trademark of Oracle Corporation, Inc.

Description
Сервер MariaDB - это разработанный сообществом форк сервера MySQL
https://mariadb.org Readme 2.7 GiB
Languages
MariaDB\ 71.8%
C++ 16.5%
C 10.3%
Shell 0.5%
Perl 0.4%
Other 0.3%