MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
Find a file
Marko Mäkelä 8751aa7397 MDEV-25404: ssux_lock_low: Introduce a separate writer mutex
Having both readers and writers use a single lock word in
futex system calls caused performance regression compared to
SRW_LOCK_DUMMY (mutex and 2 condition variables).
A contributing factor is that we did not accurately keep
track of the number of waiting threads and thus had to invoke
system calls to wake up any waiting threads.

SUX_LOCK_GENERIC: Renamed from SRW_LOCK_DUMMY. This is the
original implementation, with rw_lock (std::atomic<uint32_t>),
a mutex and two condition variables. Using a separate writer
mutex (as described below) is not possible, because the mutex ownership
in a buf_block_t::lock must be able to transfer from a write submitter
thread to an I/O completion thread, and pthread_mutex_lock() may assume
that the submitter thread is recursively acquiring the mutex that it
already holds, while in reality the I/O completion thread is the real
owner. POSIX does not define an interface for requesting a mutex to
be non-recursive.

On Microsoft Windows, srw_lock_low will remain a simple wrapper of
SRWLOCK. On 32-bit Microsoft Windows, sizeof(SRWLOCK)=4 while
sizeof(srw_lock_low)=8.

On other platforms, srw_lock_low is an alias of ssux_lock_low,
the Simple (non-recursive) Shared/Update/eXclusive lock.

In the futex-based implementation of ssux_lock_low (Linux, OpenBSD,
Microsoft Windows), we shall use a dedicated mutex for exclusive
requests (writer), and have a WRITER flag in the 'readers' lock word
to inform that a writer is holding the lock or waiting for the lock to
be granted. When the WRITER flag is set, all lock requests must acquire
the writer mutex. Normally, shared (S) lock requests simply perform a
compare-and-swap on the 'readers' word.

Update locks are implemented as a combination of writer mutex
and a normal counter in the 'readers' lock word. The conflict between
U and X locks is guaranteed by the writer mutex.
Unlike SUX_LOCK_GENERIC, wr_u_downgrade() will not wake up any pending
rd_lock() waits. They will wait until u_unlock() releases the writer mutex.

The ssux_lock_low is always wrapped by sux_lock (with a recursion count
of U and X locks), used for dict_index_t::lock and buf_block_t::lock.
Their memory footprint for the futex-based implementation will increase
by sizeof(srw_mutex), or 4 bytes.

This change addresses a performance regression in read-only benchmarks,
such as sysbench oltp_read_only. Also write performance was improved.

On 32-bit Linux and OpenBSD, lock_sys_t::hash_table will allocate
two hash table elements for each srw_lock (14 instead of 15 hash
table cells per 64-byte cache line on IA-32). On Microsoft Windows,
sizeof(SRWLOCK)==sizeof(void*) and there is no change.

Reviewed by: Vladislav Vaintroub
Tested by: Axel Schwenke and Vladislav Vaintroub
2021-04-19 18:15:49 +03:00
.github Add a Github CODEOWNERS file to project 2020-08-14 09:03:34 +10:00
BUILD Fixed BUILD script to make plugin-file_key_management DYNAMIC 2020-09-25 12:44:04 +03:00
client Merge 10.5 into 10.6 2021-03-27 18:03:03 +02:00
cmake Merge 10.5 into 10.6 2021-04-14 13:39:28 +03:00
dbug Fix cross-compile to consider CMAKE_CROSSCOMPILING_EMULATOR 2021-04-15 10:07:50 +10:00
debian Deb: Use build flag to enforce default charset as utf8mb4 2021-04-16 18:29:20 +10:00
Docs Clean up logcheck.ignore.* configs and unify MariaDB.org links with https 2020-04-23 10:07:07 +03:00
extra Merge 10.5 into 10.6 2021-04-15 20:21:11 +03:00
include Merge 10.5 into 10.6 2021-04-08 10:11:36 +03:00
libmariadb@b6f8883d96 Merge 10.4 into 10.5 2021-03-19 13:09:21 +02:00
libmysqld Merge 10.5 into 10.6 2021-02-17 19:39:05 +02:00
libservices Add build on AIX 2020-12-16 08:07:04 +11:00
man mariadb-tzinfo-to-sql,mariadb-dumpslow as Client components 2021-03-28 12:51:48 +11:00
mysql-test MDEV-25433: SKIP LOCKED should imply NOWAIT 2021-04-19 14:04:02 +10:00
mysys Merge 10.5 into 10.6 2021-04-14 12:32:27 +03:00
mysys_ssl Merge 10.3 into 10.4 2020-10-22 13:27:18 +03:00
plugin Merge 10.5 into 10.6 2021-04-14 12:32:27 +03:00
randgen/conf Group commit for maria engine. 2010-02-12 15:12:28 +02:00
scripts MDEV-25359 : Improve mariabackup SST script compliance with native MariaDB SSL practices and configuration. 2021-04-17 10:03:14 +03:00
sql MDEV-25433: SKIP LOCKED should imply NOWAIT 2021-04-19 14:04:02 +10:00
sql-bench MDEV-24854: Change innodb_flush_method=O_DIRECT by default 2021-02-20 11:58:58 +02:00
sql-common Merge 10.5 into 10.6 2021-03-26 11:50:32 +02:00
storage MDEV-25404: ssux_lock_low: Introduce a separate writer mutex 2021-04-19 18:15:49 +03:00
strings Merge branch '10.4' into 10.5 2021-02-23 13:06:22 +01:00
support-files Merge 10.5 into 10.6 2021-03-31 12:04:50 +03:00
tests Merge 10.5 into 10.6 2021-03-31 12:04:50 +03:00
tpool io_liburing: ENOMEM handling - use io_uring_mlock_size 2021-04-15 07:42:13 +10:00
unittest unittest: my_getopt-t errors on -ve ul{l,} 2021-04-07 14:05:04 +10:00
vio Merge 10.5 into 10.6 2021-03-27 18:03:03 +02:00
win Merge branch '10.4' into 10.5 2021-02-23 13:06:22 +01:00
wsrep-lib@a93955ddee Update wsrep-lib 2021-01-08 08:44:18 +02:00
zlib Merge branch '10.3' into 10.4 2020-12-25 09:13:28 +01:00
.clang-format Merge 10.4 into 10.5 2019-12-27 21:17:16 +02:00
.gitattributes .gitattributes - correct language detection 2021-01-15 18:29:35 +11:00
.gitignore MDEV-5536: add systemd socket activation 2021-03-28 13:53:55 +11:00
.gitmodules Add stub for building ColumnStore 2020-06-19 21:04:17 +02:00
.travis.compiler.sh MDEV-19780 Remove the TokuDB storage engine 2020-05-14 10:11:47 +03:00
.travis.yml MDEV-25090: Deb: Use libpmem-dev when available 2021-03-17 13:23:18 +02:00
appveyor.yml Fix appvyeor's perl.exe path 2020-11-03 10:47:25 +01:00
BUILD-CMAKE Minor spelling fixes in code comments, docs and output 2018-01-12 16:49:02 +02:00
CMakeLists.txt Merge 10.5 into 10.6 2021-04-15 20:21:11 +03:00
config.h.cmake Merge 10.5 into 10.6 2021-04-14 13:39:28 +03:00
configure.cmake Merge 10.5 into 10.6 2021-04-15 20:21:11 +03:00
CONTRIBUTING.md Add CONTRIBUTING file and modify README file about live QA regarding new contributors 2018-12-04 23:15:33 +04:00
COPYING Update FSF Address 2019-05-11 21:29:06 +03:00
CREDITS Update sponsors 2021-03-12 07:02:29 +11:00
dml_handler.diff MDEV-20220: Merge 5.7 P_S replication table 'replication_applier_status_by_worker 2021-04-08 17:19:51 +05:30
EXCEPTIONS-CLIENT MDEV-5645 MariaDB-5.5.35 - references are made to an "EXCEPTIONS-CLIENT" file but it does not exist 2014-05-31 13:18:56 +02:00
information_schema.diff MDEV-20220: Merge 5.7 P_S replication table 'replication_applier_status_by_worker 2021-04-08 17:19:51 +05:30
INSTALL-SOURCE Update AskMonty and Atlassian references to MariaDB 2016-03-08 15:24:01 +02:00
INSTALL-WIN-SOURCE Update AskMonty and Atlassian references to MariaDB 2016-03-08 15:24:01 +02:00
KNOWN_BUGS.txt Changed some MySQL names in messages to MariaDB 2018-12-09 20:49:05 +02:00
README.md Update README 2020-05-05 18:28:52 +02:00
THIRDPARTY Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
VERSION bump the VERSION 2021-02-22 10:04:25 -05:00

Code status:

  • Travis CI status travis-ci.org (10.5 branch)
  • Appveyor CI status ci.appveyor.com

MariaDB: The open source relational database

MariaDB was designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

MariaDB is brought to you by the MariaDB Foundation and the MariaDB Corporation. Please read the CREDITS file for details about the MariaDB Foundation, and who is developing MariaDB.

MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Corporation, the MariaDB Foundation and by many people in the community.

MySQL, which is the base of MariaDB, is a product and trademark of Oracle Corporation, Inc. For a list of developers and other contributors, see the Credits appendix. You can also run 'SHOW authors' to get a list of active contributors.

A description of the MariaDB project and a manual can be found at:

https://mariadb.org

https://mariadb.com/kb/en/

https://mariadb.com/kb/en/mariadb-vs-mysql-features/

https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/

https://mariadb.com/kb/en/new-and-old-releases/

Help

More help is available from the Maria Discuss mailing list https://launchpad.net/~maria-discuss, MariaDB's Zulip instance, https://mariadb.zulipchat.com/ and the #maria IRC channel on Freenode.

Live QA for beginner contributors

MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC. From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions theyd like, and a live developer will be available to assist.

New contributors can ask questions any time, but we will provide immediate feedback during that interval.

Licensing


NOTE:

MariaDB is specifically available only under version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in the MySQL distribution for more information.

License information can be found in the COPYING file. Third party license information can be found in the THIRDPARTY file.


Bug Reports

Bug and/or error reports regarding MariaDB should be submitted at: https://jira.mariadb.org

For reporting security vulnerabilities see: https://mariadb.org/about/security-policy/

The code for MariaDB, including all revision history, can be found at: https://github.com/MariaDB/server