Commit graph

194637 commits

Author SHA1 Message Date
Michael Okoko
2aca7b0c33 Prepare JSON as valid histogram_type
Signed-off-by: Michael Okoko <okokomichaels@outlook.com>
2022-01-19 18:10:07 +03:00
Vladislav Vaintroub
e222e44d1b Merge branch 'preview-10.8-MDEV-26713-Windows-i18-support' into 10.8 2022-01-18 21:37:52 +01:00
Vladislav Vaintroub
2e48fbe3f5 MDEV-27525 Invalid (non-UTF8) characters found for option 'plugin_dir'
Two Problems
1. Upgrade wizard failed to retrieve path to service executable,
if it contained non-ASCII.
Fixed by setlocale(LC_ALL, "en_US.UTF8"), which was missing in upgrade wizard

2.mysql_upgrade_service only updated (converted to UTF8) the server's sections
leaving client's as-is

Corrected typo.

3. Fixed assertion in my_getopt, turns out to be too strict.
2022-01-18 17:32:53 +01:00
Daniel Black
d9f7a6b331 MDEV-27158: humanize the bytes in innodb info/error messages
Log messages like total size = 17179869184, chunk size = 134217728
get hard to read. If we normalize it down to IEC units is easier.

Idea thanks to Axel Schwenke.

Review thanks to Eugene Kosov and Marko Mäkelä

$ mariadblocal --innodb-buffer-pool-size=30G --innodb-log-file-size=128M
Installing MariaDB/MySQL system tables in '/tmp/build-mariadb-server-10.7-datadir' ...
2021-12-09  9:54:04 0 [Note] /home/dan/repos/build-mariadb-server-10.7/sql/mysqld (server 10.7.2-MariaDB) starting as process 250473 ...
2021-12-09  9:54:04 0 [Note] InnoDB: The first data file './ibdata1' did not exist. A new tablespace will be created!
2021-12-09  9:54:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-12-09  9:54:04 0 [Note] InnoDB: Number of transaction pools: 1
2021-12-09  9:54:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-12-09  9:54:04 0 [Note] InnoDB: Using liburing
2021-12-09  9:54:04 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 128.000MiB
2021-12-09  9:54:04 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-09  9:54:04 0 [Note] InnoDB: Setting O_DIRECT on file ./ibdata1 failed
2021-12-09  9:54:04 0 [Note] InnoDB: Setting file './ibdata1' size to 12.000MiB. Physically writing the file full; Please wait ...
2021-12-09  9:54:04 0 [Note] InnoDB: File './ibdata1' size is now 12.000MiB.
2021-12-09  9:54:04 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 96.000MiB
2021-12-09  9:54:04 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2021-12-09  9:54:04 0 [Note] InnoDB: New log file created, LSN=10317
2021-12-09  9:54:04 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2021-12-09  9:54:04 0 [Note] InnoDB: Doublewrite buffer created
2021-12-09  9:54:04 0 [Note] InnoDB: 128 rollback segments are active.
2021-12-09  9:54:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-12-09  9:54:04 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2021-12-09  9:54:04 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2021-12-09  9:54:04 0 [Note] InnoDB: 10.7.2 started; log sequence number 0; transaction id 3
OK
2021-12-09  9:54:04 0 [Note] sql/mysqld (server 10.7.2-MariaDB) starting as process 250501 ...
2021-12-09  9:54:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-12-09  9:54:04 0 [Note] InnoDB: Number of transaction pools: 1
2021-12-09  9:54:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-12-09  9:54:04 0 [Note] InnoDB: Using liburing
2021-12-09  9:54:04 0 [Note] InnoDB: Initializing buffer pool, total size = 30.000GiB, chunk size = 128.000MiB
2021-12-09  9:54:04 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-09  9:54:04 0 [Note] InnoDB: Setting O_DIRECT on file ./ibdata1 failed
2021-12-09  9:54:04 0 [Note] InnoDB: Resizing redo log from 96.000MiB to 128.000MiB; LSN=41361
2021-12-09  9:54:04 0 [Note] InnoDB: Starting to delete and rewrite log file.
2021-12-09  9:54:04 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 128.000MiB
2021-12-09  9:54:04 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2021-12-09  9:54:04 0 [Note] InnoDB: New log file created, LSN=41361
2021-12-09  9:54:04 0 [Note] InnoDB: 128 rollback segments are active.
2021-12-09  9:54:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-12-09  9:54:04 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2021-12-09  9:54:04 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2021-12-09  9:54:04 0 [Note] InnoDB: 10.7.2 started; log sequence number 41349; transaction id 14
2021-12-09  9:54:04 0 [Note] InnoDB: Loading buffer pool(s) from /tmp/build-mariadb-server-10.7-datadir/ib_buffer_pool
2021-12-09  9:54:04 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-12-09  9:54:04 0 [Note] InnoDB: Buffer pool(s) load completed at 211209  9:54:04
2021-12-09  9:54:04 0 [Note] sql/mysqld: ready for connections.
Version: '10.7.2-MariaDB'  socket: '/tmp/build-mariadb-server-10.7.sock'  port: 0  Source distribution
2021-12-09  9:56:57 0 [Note] sql/mysqld (initiated by: unknown): Normal shutdown
2021-12-09  9:56:57 0 [Note] InnoDB: FTS optimize thread exiting.
2021-12-09  9:56:57 0 [Note] InnoDB: Starting shutdown...
2021-12-09  9:56:57 0 [Note] InnoDB: Dumping buffer pool(s) to /tmp/build-mariadb-server-10.7-datadir/ib_buffer_pool
2021-12-09  9:56:57 0 [Note] InnoDB: Buffer pool(s) dump completed at 211209  9:56:57
2021-12-09  9:56:57 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2021-12-09  9:56:57 0 [Note] InnoDB: Shutdown completed; log sequence number 42602; transaction id 15
2021-12-09  9:56:57 0 [Note] sql/mysqld: Shutdown complete
2022-01-18 14:20:59 +02:00
Daniel Black
d434250ee1 MDEV-25342: autosize innodb_buffer_pool_chunk_size
The previous default innodb_buffer_pool_chunk_size of 128M
made sense when the innodb buffer pool size was a few GB.

When the pool size is 128GB this means the chunk size is 0.1%
of this. Fine tuning the buffer pool size on such a fine
increment doesn't make practical sense. Also on extremely
large buffer pool systems, initializing on the default 128M can
also take a considerable amount of time.

When large pages are enabled, the chunk size has to be a multiple
of an available large page size or memory allocation without
use can occur.

Previously the default 0 was documented as disabling resizing.
With srv_buf_pool_chunk_unit > 0 assertions in the code and the
minimium value set, I doubt this was ever the case.

As such the autosizing (based on default 0) takes place as follows:
* a 64th of the innodb_buffer_pool_size
* if large pages, this is rounded down the the nearest multiple
  of the large page size.
* If less than 1MB, set to 1MB.

This does mean the new default innodb_buffer_pool_chunk size is
2MB, derived form the above formular with 128MB as the buffer pool
size.

The innodb_buffer_pool_chunk_size is changed to a size_t for
better compatiblity with the memory allocations which use size_t.
The previous upper limit is changed to the maxium of a size_t. The
maximium value used is the buffer pool size anyway.

Getting this default value of the chunk size to a more practical
size facilitates further development of more automated resizing
without significant overhead or memory fragmentation.

innodb_buffer_pool_resize test adjusted based on 1M default
chunk size thanks Wlad.
2022-01-18 14:20:57 +02:00
Marko Mäkelä
e5b75ac3d7 Merge 10.7 into 10.8 2022-01-18 13:19:00 +02:00
Marko Mäkelä
b0998583f8 Merge 10.6 into 10.7 2022-01-18 13:01:19 +02:00
Marko Mäkelä
1abc476f0b Merge 10.5 into 10.6 2022-01-18 12:59:50 +02:00
Marko Mäkelä
e44439ab73 MDEV-27499 Performance regression in log_checkpoint_margin()
In commit 4c3ad24413 (MDEV-27416)
an unnecessarily strict wait condition was introduced in the
function buf_flush_wait(). Most callers actually only care that
the pages have been flushed, not that a checkpoint has completed.

Only in the buf_flush_sync() call for log resizing, we might care
about the log checkpoint. But, in fact,
srv_prepare_to_delete_redo_log_file() is explicitly disabling
checkpoints. So, we can simply remove the unnecessary wait loop.

Thanks to Krunal Bauskar for reporting this performance regression
that we failed to repeat in our testing.
2022-01-18 12:57:15 +02:00
Sergei Golubchik
745aa8bee7 MDEV-26230 mysql_upgrade fails to load type_mysql_json due to insufficient maturity level
bump maturity to beta
2022-01-17 18:16:27 +01:00
Sergei Golubchik
5af6a13771 MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server
don't auto-succeed every DROP TABLE
2022-01-17 18:16:27 +01:00
Marko Mäkelä
f18e25649d MDEV-27461: Buffer pool resize fails to wake up the page cleaner
buf_pool_t::realloc(): Invoke page_cleaner_wakeup()
if buf_LRU_get_free_only() returns a null pointer.

Ever since commit 7b1252c03d (MDEV-24278)
the page cleaner would remain in untimed sleep, expecting explicit
calls to buf_pool_t::page_cleaner_wakeup() when the ratio of dirty pages
could change.

Failure to wake up the page cleaner will cause all page writes to be
initiated by buf_flush_LRU_list_batch(). That might work too,
provided that the buffer pool size is at least BUF_LRU_MIN_LEN (256)
pages, but it would not advance the log checkpoint.
2022-01-17 16:09:09 +02:00
Marko Mäkelä
343f695c7f MDEV-27469: Assertion failure in defragment due to tx_read_only
In commit c5fd9aa562 (MDEV-25919)
we prevented the function dict_stats_save_index_stat()
from being called in read-only mode in dict_stats_save(),
but not elsewhere.

dict_stats_save_defrag_summary(), dict_stats_save_defrag_stats():
If the transaction is in read-only mode, return DB_READ_ONLY
and do not attempt to lock or modify anything.
2022-01-17 11:19:41 +02:00
Otto Kekäläinen
4775a40627 Deb: Track libmariadb3 ABI explicitly to detect future symbol changes
When this file exists, Debian builds will automatically compare the built
ABI and symbols to the ones defined in the list. If there is a mismatch,
developers need to update the libmariadb3.symbols file, otherwise the build
fails.

This ensures there are no accidental symbol changes. This also helps track
what symbols changed and in what versions.

Also add a README embedded in the sources to facilitate correct use of this
new file.

This change is made for branch 10.2, as it was the first server version to
introduce an embedded libmariadb3 client library, and from this version
the file with the same libmariadb3 specific content will be merged to
10.3, 10.4 and 10.5.

Related: MDEV-21732
2022-01-16 13:23:02 -08:00
Nayuta Yanagisawa
b7e4dc121a MDEV-27240 fixup: remove dead code 2022-01-15 21:24:25 +09:00
Nayuta Yanagisawa
64f844b611 MDEV-27240 fixup: remove #ifdef in macro call
Windows builds failed due to the following error:
'#': invalid character: possibly the result of a macro expansion
2022-01-15 17:33:48 +09:00
Nayuta Yanagisawa
2ecd39c983 MDEV-27240 SIGSEGV in ha_spider::store_lock on LOCK TABLE
The commit e954d9de gave different lifetime to wide_share and
partition_handler_share. This introduced the possibility that
partition_handler_share could be accessed even after it was freed.

We stop sharing partitoiin_handler_share and make it belong to
a single wide_handler to fix the problem.
2022-01-15 13:25:09 +09:00
Marko Mäkelä
8535c260dd Remove FIXME comments that refer to an early MDEV-14425 plan
In MDEV-14425, an early plan was to introduce a separate log file
for file-level records and checkpoint information. The reasoning was
that fil_system.mutex contention would be reduced by not having to
maintain fil_system.named_spaces. The mutex contention was actually
fixed in MDEV-23855 by making some data fields in fil_space_t and
fil_node_t use std::atomic.

Using a single circular log file simplifies recovery and backup.
2022-01-14 20:27:51 +02:00
Marko Mäkelä
347f6d01e3 Merge 10.7 into 10.8 2022-01-14 19:47:33 +02:00
Marko Mäkelä
c669e764d8 Merge 10.6 into 10.7 2022-01-14 19:30:14 +02:00
Marko Mäkelä
16b87f9890 Merge 10.5 into 10.6 2022-01-14 18:19:04 +02:00
Marko Mäkelä
c104a01b50 MDEV-27500 buf_page_free() fails to drop the adaptive hash index
The function buf_page_free() that was introduced
in commit a35b4ae898 (MDEV-15528)
failed to remove any adaptive hash index entries for the page
before freeing the page.

This caused an assertion failure on shutdown of 10.6 server of
in the function buf_pool_t::clear_hash_index() with the expression:
(s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH).
The assertion would fail for a block that is in the freed state.

The failing assertion was added in
commit aaef2e1d8c
in the 10.6 branch.

Thanks to Matthias Leich for finding the bug and testing the fix.
2022-01-14 17:42:19 +02:00
Marko Mäkelä
e6a0611388 MDEV-27058 fixup: Bogus assertion !block->page.is_io_fixed()
buf_page_get_gen(): After recv_sys_t::recover_low() returned,
the page must not be read-fixed, but it may be write-fixed,
because the io-fix state is protected by block->page.lock,
which we are not holding yet.

Also, let us copy the block descriptor state to a local variable
for examination, so that in case an assertion would fail again,
we will have the sampled state in the core dump. In a core dump of
the assertion failure, we had block->page.fix() == buf_page_t::UNFIXED,
that is, the assertion expression was holding again.
2022-01-13 16:45:31 +02:00
Marko Mäkelä
4b14874c28 Merge 10.7 into 10.8 2022-01-12 17:08:08 +02:00
Aleksey Midenkov
6831b3f2a0 MDEV-26824 Can't add foreign key with empty referenced columns list
create_table_info_t::create_foreign_keys() expects equal number of
iterations through fk->columns and fk->ref_columns. If fk->ref_columns
is empty copy it from fk->columns.
2022-01-12 17:18:38 +03:00
Thirunarayanan Balathandayuthapani
a90e1165fd MDEV-27312 LeakSanitizer error in trx_mod_table_time_t::start_bulk_insert
- InnoDB fails to apply the bulk insert operation for the stats
table during DDL. During create table, InnoDB does dict_stats_save()
and freshly insert into innodb_table_stats and innodb_index_stats
table.
2022-01-12 17:38:15 +05:30
Thirunarayanan Balathandayuthapani
03ed2e9d97 MDEV-27318 Assertion `data_size < srv_sort_buf_size' failed in row_merge_bulk_buf_add
InnoDB fails to add the tuple size which is greater than
innodb_sort_buffer_size. InnoDB should write the field
which are greater than 2000 bytes into the temporary file
and place the offset, length and make it as a new tuple.
InnoDB should buffer the newly created tuple without any
problem during bulk index
2022-01-12 17:37:06 +05:30
Marko Mäkelä
a23f3ee84e Merge 10.6 into 10.7 2022-01-12 13:14:58 +02:00
Marko Mäkelä
ba5ef63ae1 MDEV-27476 heap-use-after-free in buf_pool_t::is_block_field()
This follows up commit 017d1b867b.
In commit aaef2e1d8c (MDEV-27058)
some more problematic debug assertions were added.

btr_search_update_block_hash_info(), trx_purge_truncate_history():
Use simpler assertions to check that an uncompressed page is present.
2022-01-12 12:34:07 +02:00
Marko Mäkelä
0261eac57f Merge 10.5 into 10.6 2022-01-12 12:33:19 +02:00
Marko Mäkelä
017d1b867b MDEV-27476 heap-use-after-free in buf_pool_t::is_block_field()
mtr_t::modify(): Remove a debug assertion that had been added
in commit 05fa4558e0 (MDEV-22110).
The function buf_pool_t::is_uncompressed() is only safe to invoke
while holding a buf_pool.page_hash latch so that buf_pool_t::resize()
cannot concurrently invoke free() on any chunks.
2022-01-12 12:29:16 +02:00
Eugene Kosov
f443cd1100 MDEV-27022 Buffer pool is being flushed during recovery
The problem was introduced by the removal of buf_pool.flush_rbt
in commit 46b1f50098 (MDEV-23399)

recv_sys_t::apply(): don't write to disc and fsync() the last batch.
Insead, sort it by oldest_modification for MariaDB server and some
mariabackup operations.

log_sort_flush_list(): a thread-safe function which sorts buf_pool::flush_list
2022-01-11 16:20:20 +03:00
Sergei Golubchik
f825954558 C/C 3.3 2022-01-11 10:11:31 +01:00
Thirunarayanan Balathandayuthapani
428b057ee0 MDEV-27640 trx_has_lock_x() gives wrong result if the table has pending table lock
trx_has_lock_x() fails to find whether the trx has X-lock on the table
when other transactions are waiting for an X or S lock on the table.
2022-01-10 19:19:15 +05:30
Marko Mäkelä
fcbd398924 Cleanup: Remove unused log_cmdq_key
There was an intention to add a CommandQueue in
mysql/mysql-server@eca5b0fc17
but it never appeared in any release (not even MySQL 5.7.3
where that commit appeared).
2022-01-10 11:21:17 +02:00
Rucha Deodhar
81e00485c3 MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)

Analysis: KILL_QUERY is not ignored when local memory used exceeds maximum
session memory. Hence the query proceeds, OK is sent and we end up
reopening tables that are marked for reopen. During this, kill status is
eventually checked and assertion failure happens during trying to send error
message because OK has already been sent.
Fix: Ok is already sent so statement has already executed. It is too
late to give error. So ignore kill.
2022-01-10 13:31:01 +05:30
Vladislav Vaintroub
c62bb9c3b4 Silence CMake warning from exteral cmake project (pcre2)
The warning reads:

CMake Deprecation Warning at CMakeLists.txt:101 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
2022-01-09 23:52:24 +01:00
Marko Mäkelä
75d4c530c5 MDEV-26879: Detach innodb_evict_tables_on_commit_debug from SAFE_MUTEX
In commit 18535a4028 (MDEV-24811)
the implementation of innodb_evict_tables_on_commit_debug
depended on dict_sys.mutex and SAFE_MUTEX.
That is no longer the case.

SAFE_MUTEX is not available on Microsoft Windows.
2022-01-09 14:09:00 +02:00
Hugo Wen
a81c75f5a9 MDEV-27435: Support extra initialization file for mysql_install_db
The mysql_install_db script is used to initialize the data directory.
However, if the user needs to apply some customized init commands (for
example to change user or password) they have to start the database
with `--skip-grant-tables` after the install script, and then restart
the database with normal mode.

To make it easier to include customization in the mysql_install_db
script, in this commit, a new parameter `extra-file` is added in
mysql_install_db script to support some extra customized init commands.

With this option we can support applying extra file containing sql for
mysql_install_db command line at runtime, which reduces the complexity
of customized initialization process.

This script is only used for install and is not included in the mtr
bootstrap file.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
2022-01-07 15:27:14 +11:00
Daniel Black
4f4d9586de mysys: my_rdtsc note about ARM counter
As reported in https://github.com/MariaDB/mariadb-docker/issues/338
and later https://github.com/hardkernel/linux/issues/423.

While modern kernels support this, it seems older hardware may be
stuck at kernel versions without this initialization.
2022-01-06 10:36:55 +11:00
alexfanqi
d18f6f2631 MDEV-27429: Support RISC-V cycle timer
Adapted from https://github.com/google/benchmark/pull/833
authored by Sam Elliot at lowRISC.

This requires the RISCV kernel to set the CY bit of the mcountern register
which is done on Linux, but documenting here in case another OS hits
a SIGILL here.

When CY bit of the mcounteren register is unset, reading the cycle register
will cause illegal instruction exception in the next privilege level ( user
mode or supervisor mode ). See the privileged isa manual section 3.1.11 in
https://github.com/riscv/riscv-isa-manual/releases/latest
2022-01-06 10:36:55 +11:00
Thirunarayanan Balathandayuthapani
e8d1bb0459 MDEV-27017 Assertion failure 'table->get_ref_count() == 0' on DDL that involves FULLTEXT INDEX
purge_sys.stop_FTS() does not wait for purge operation
on FTS tables to finish. InnoDB DDL does purge_sys.stop_FTS()
and lock all fts tables. It eventually fails due to
n_ref_count value.

fts_stop_purge(): Stops the purge thread to process new FTS tables,
check n_ref_count of all fts index auxiliary, common tables.
This should make sure that consecutive fts_lock_tables()
is always successful.
2022-01-05 20:09:50 +05:30
Marko Mäkelä
59e8a12657 MDEV-26879 innodb_evict_tables_on_commit_debug=on makes table creation hang
In commit c5fd9aa562 (MDEV-25919)
an incorrect change to lock_release() was applied.

The setting innodb_evict_tables_on_commit_debug=on should only be
applied to normal transactions, not DDL transactions in the likes of
CREATE TABLE, nor transactions that are holding dict_sys.latch,
such as dict_stats_save().
2022-01-05 12:14:01 +02:00
Vladislav Vaintroub
2a6e086902 MDEV-27335 Windows, MSI - Bring the datadir location into the instance config UI 2022-01-05 10:46:54 +01:00
Vladislav Vaintroub
3712808ad2 Windows installer - fix UI of the "Uninstall" Dialog.
Give RemoveDatadirText field extra 10 pixels in height, to avoid
truncated display of directory path
2022-01-05 10:46:54 +01:00
Jesús Marín
b773416888 Update errmsg-utf8.txt (spa) part 2
Further changes to 3e0304884b

New changes in translation:

* Converted to LATAM countries treatment: tú for vd. This way it serves good for Spain and all LATAM countries.
* Minor changes
2022-01-05 12:19:59 +11:00
Marko Mäkelä
b0d632a840 Merge 10.7 into 10.8 2022-01-04 15:56:14 +02:00
Marko Mäkelä
ce663ad4e4 Merge 10.6 into 10.7 2022-01-04 15:54:19 +02:00
Marko Mäkelä
cd751f0259 Work around MDEV-27421 ./mtr --ps-protocol main.opt_trace 2022-01-04 15:53:02 +02:00
Marko Mäkelä
daf4fa5238 Merge 10.7 into 10.8 2022-01-04 10:30:45 +02:00