Commit graph

188553 commits

Author SHA1 Message Date
Marko Mäkelä
4431144ae5 MDEV-12353: Make UNDO_APPEND more robust
This is a follow-up to commit 84e3f9ce84
that introduced the EXTENDED log record of UNDO_APPEND subtype.

mtr_t::undo_append(): Accurately enforce the mtr_buf_t::MAX_DATA_SIZE
limit. Also, replace mtr_buf_t::push() with simpler code, to append 1 byte
to the log.

log_phys_t::undo_append(): Return whether the page was found to
be in an inconsistent state.

log_phys_t::apply(): If corruption was noticed, stop applying log
unless innodb_force_recovery is set.
2020-02-27 16:47:00 +02:00
Sergey Vojtovich
a346ff353e cleanup trailing ws 2020-02-27 18:12:47 +04:00
Daniel-Solo
127fee998f MDEV-10569: Add RELEASE_ALL_LOCKS function. Implementing the SQL
function to release all named locks
2020-02-27 14:37:19 +04:00
Sergei Golubchik
98adcffe46 Revert "MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT"
This reverts commit 9894751a2a.
This reverts commit f707c83fff.
2020-02-27 10:30:21 +01:00
Aleksey Midenkov
9894751a2a Compilation fix 2020-02-25 20:58:03 +03:00
Aleksey Midenkov
f707c83fff MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
When there are E empty partitions left, auto-create N new empty
partitions for SYSTEM_TIME partitioning rotated by INTERVAL/LIMIT and
marked by AUTO_INCREMENT keyword. Syntax change: AUTO_INCREMENT
keyword (or shorter AUTO may be used instead) after LIMIT/INTERVAL
clause.

CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME LIMIT 100000 AUTO_INCREMENT;

CREATE OR REPLACE TABLE t (x INT) WITH SYSTEM VERSIONING
PARTITION BY SYSTEM_TIME INTERVAL 1 WEEK AUTO_INCREMENT;

The current revision implements hard-coded values of 1 for E and N. As
well as auto-creation threshold MinInterval = 1 hour, MinLimit = 1000.

The name for newly added partition will be first chosen as "pX", where
X is partition number and "p" is hard-coded name prefix. If this name
is already occupied, the X will be incremented until the resulting
name will be free to use.

ALTER TABLE ADD PARTITION is now always fast. If there some history
partition overflow occurs manual ALTER TABLE REBUILD PARTITION is
needed.
2020-02-25 15:43:23 +03:00
Namrata Bhave
c12609dd9e Review comments: Refactoring the duplicates
Have separated out the common dependencies on top.
2020-02-24 19:01:51 +02:00
Namrata Bhave
193bc89a49 Adding s390x to Travis builds 2020-02-24 19:01:51 +02:00
Eugene Kosov
852dcb9a56 try to fix sysvars_innodb,32bit test 2020-02-24 17:21:21 +03:00
Marko Mäkelä
0eca30a70d MDEV-21749: page_cur_insert_rec_low(): Assertion rdm - rd + bd <= insert_buf + rec_size failed.
This bug was introduced in
commit 7ae21b18a6
(the main commit of MDEV-12353).

page_cur_insert_rec_low(): Before entering the comparison loop, make sure
that the range does not exceed c_end already at the start of the loop.
The loop is only comparing for pointer equality, and that condition
cdm == c_end would never hold if the end was already exceeded in
the beginning. Also, skip the comparison altogether if we could find
at most 2 equal bytes.

PageBulk::insertPage(): Apply a similar change. It seems that this
code was correct, because the loop checks for cdm < c_end.
2020-02-24 16:12:48 +02:00
Marko Mäkelä
956e12d639 MDEV-12353: Fix cmake -DWITH_INNODB_EXTRA_DEBUG
The compilation was accidentally broken in
commit 22f649a67a.
2020-02-24 15:13:00 +02:00
Marko Mäkelä
572d20757b MDEV-12353: Reduce log volume of page_cur_delete_rec()
mrec_ext_t: Introduce DELETE_ROW_FORMAT_REDUNDANT,
DELETE_ROW_FORMAT_DYNAMIC.

mtr_t::page_delete(): Write DELETE_ROW_FORMAT_REDUNDANT or
DELETE_ROW_FORMAT_DYNAMIC log records. We log the byte offset
of the preceding record, so that on recovery we can easily
find everything to update. For DELETE_ROW_FORMAT_DYNAMIC,
we must also write the header and data size of the record.

We will retain the physical logging for ROW_FORMAT=COMPRESSED pages.

page_zip_dir_balance_slot(): Renamed from page_dir_balance_slot(),
and specialized for ROW_FORMAT=COMPRESSED only.

page_rec_set_n_owned(), page_dir_slot_set_n_owned(),
page_dir_balance_slot(): New variants that do not write any log.

page_mem_free(): Take data_size, extra_size as parameters.
Always zerofill the record payload.

page_cur_delete_rec(): For other than ROW_FORMAT=COMPRESSED,
only write log by mtr_t::page_delete().
2020-02-22 21:19:47 +02:00
Jan Lindström
bc76cfe8f8 Disable galera_as_slave_gtid_replicate_do_db_cc because it crashes. 2020-02-21 11:57:29 +02:00
Jan Lindström
e253e3560d MDEV-21601 : Cleanup Galera disabled tests
* Remove those tests that will not be supported on that release.
* Make sure that correct tests are disabled and have MDEVs
* Sort test names
2020-02-21 08:29:01 +02:00
Jan Lindström
17e1848b66 Fix Galera test galera_as_slave_ctas. 2020-02-21 08:27:31 +02:00
Jan Lindström
d872cd6e4a MDEV-21420 : Galera test failure on galera.mysql-wsrep#33
Add more tests and move SST restore to correct place.
2020-02-21 08:27:21 +02:00
Jan Lindström
929e44b245 MDEV-21514 : Galera test failure on galera.galera_wan_restart_sst on Azure
Remove sleeps and unnecessary waits.
2020-02-21 08:27:06 +02:00
Alexander E. Patrakov
316e41e39e MDEV-21140 Make galera_recovery.sh work with fs.protected_regular = 1 (#1417)
The log file is opened as root since commit bb7a70c, so there is no need
to chown it.
2020-02-21 08:26:54 +02:00
Jan Lindström
713c5ea5bc MDEV-18180 : Galera test failure on galera.galera_concurrent_ctas
Test changes only.
2020-02-21 08:26:02 +02:00
Jan Lindström
77eb22fd58 MDEV-21517 : Galera test galera_sr.GCF-561 failure: Result length mismatch
Add wait conditions.
2020-02-21 08:25:51 +02:00
Jan Lindström
6cc819b413 MDEV-21421 : Galera test sporadic failure on galera.galera_as_slave_gtid_myisam: Result length mismatch
In Galera 4 nodes 1 and 2 are galera nodes and node_3 should be
non galera.
2020-02-21 08:25:40 +02:00
Jan Lindström
4b99358953 MDEV-21601 : Cleanup Galera disabled tests
* Remove those tests that will not be supported on that release.
* Make sure that correct tests are disabled and have MDEVs
* Sort test names

This should not be merged upwards.
2020-02-21 08:25:20 +02:00
Marko Mäkelä
96901d9545 Cleanup: Remove dict_ind_redundant
There is no reason for the dummy index object dict_ind_redundant
to exist any more. It was only being passed to btr_create().

btr_create(): If !index, assume that a ROW_FORMAT=REDUNDANT
table is being created.

We could pass ibuf.index, dict_sys.sys_tables->indexes.start
and so on, if those objects had been initialized before the
function btr_create() is called.
2020-02-20 22:00:43 +02:00
Eugene Kosov
6618fc2974 MDEV-21774 Innodb, Windows : restore file sharing logic in Innodb
recv_sys_t opened redo log files along with log_sys_t. That's why I
removed file sharing logic from InnoDB
in 9ef2d29ff4
But it was actually used to ensure that only one MariaDB instance
will touch the same InnoDB files.

os0file.cc: revert some changes done previously

mapped_file_t::map(): now has arguments read_only, nvme

file_io::open(): now has argument read_only

class file_os_io: make final

log_file_t::open(): now has argument read_only
2020-02-20 18:24:21 +03:00
Marko Mäkelä
84e3f9ce84 MDEV-12353: Reduce log volume by an UNDO_APPEND record
We introduce an EXTENDED log record for appending an undo log record
to an undo log page. This is equivalent to the MLOG_UNDO_INSERT record
that was removed in commit f802c989ec,
only using more compact encoding.

mtr_t::log_write(): Fix a bug that affects longer log
record writes in the !same_page && !have_offset case.
Similar code is already implemented for the have_offset code path.
The bug was unobservable before we started to write longer
EXTENDED records. All !have_offset records (FREE_PAGE, INIT_PAGE,
EXTENDED) that were written so far are short, and we never write
RESERVED or OPTION records.

mtr_t::undo_append(): Write an UNDO_APPEND record.

log_phys_t::undo_append(): Apply an UNDO_APPEND record.

trx_undo_page_set_next_prev_and_add(),
trx_undo_page_report_modify(),
trx_undo_page_report_rename():
Invoke mtr_t::undo_append() instead of emitting WRITE records.
2020-02-19 16:42:38 +02:00
Marko Mäkelä
86f262f1c7 MDEV-12353: Reduce log volume by an UNDO_INIT record
We introduce an EXTENDED log record for initializing an undo log page.
The size of the record will be 2 bytes plus the optional page identifier.
The entire undo page will be initialized, except the space that is
already reserved for TRX_UNDO_SEG_HDR in trx_undo_seg_create().

mtr_t::undo_create(): Write the UNDO_INIT record.

trx_undo_page_init(): Initialize the undo page corresponding to the
UNDO_INIT record. Unlike the former MLOG_UNDO_INIT record, we will
initialize almost the entire page, including initializing the
TRX_UNDO_PAGE_NODE to an empty list node, so that the subsequent call
to flst_init() will avoid writing log for the undo page.
2020-02-19 15:52:16 +02:00
Eugene Kosov
3ee100b0d1 revert accidental libmariadb change 2020-02-19 16:39:02 +03:00
Eugene Kosov
29bb3744b4 fix libpmem InnoDB linking 2020-02-19 16:37:06 +03:00
Eugene Kosov
e62e285fc4 remove unused function 2020-02-19 12:51:08 +03:00
Eugene Kosov
9ef2d29ff4 MDEV-14425 deprecate and ignore innodb_log_files_in_group
Now there can be only one log file instead of several which
logically work as a single file.

Possible names of redo log files: ib_logfile0,
ib_logfile101 (for just created one)

innodb_log_fiels_in_group: value of this variable is not used
by InnoDB. Possible values are still 1..100, to not break upgrade

LOG_FILE_NAME: add constant of value "ib_logfile0"
LOG_FILE_NAME_PREFIX: add constant of value "ib_logfile"

get_log_file_path(): convenience function that returns full
path of a redo log file

SRV_N_LOG_FILES_MAX: removed

srv_n_log_files: we can't remove this for compatibility reasons,
but now server doesn't use this variable

log_sys_t::file::fd: now just one, not std::vector

log_sys_t::log_capacity: removed word 'group'

find_and_check_log_file(): part of logic from huge srv_start()
moved here

recv_sys_t::files: file descriptors of redo log files.
There can be several of those in case we're upgrading
from older MariaDB version.

recv_sys_t::remove_extra_log_files: whether to remove
ib_logfile{1,2,3...} after successfull upgrade.

recv_sys_t::read(): open if needed and read from one
of several log files

recv_sys_t::files_size(): open if needed and return files count

redo_file_sizes_are_correct(): check that redo log files
sizes are equal. Just to log an error for a user.
Corresponding check was moved from srv0start.cc

namespace deprecated: put all deprecated variables here to
prevent usage of it by us, developers
2020-02-19 12:21:59 +03:00
Jan Lindström
8d7a8e45bf Update wsrep-lib submodule. 2020-02-19 09:35:48 +02:00
Marko Mäkelä
9fd309498c MDEV-12353 Cleanup: Rename INIT_INDEX_PAGE to EXTENDED
We plan use the redo log record main type code 0x20 for
InnoDB specific index page operations.

mrec_type_t: Rename INIT_INDEX_PAGE to EXTENDED.

mrec_ext_t: The EXTENDED subtypes.

This is a non-functional change: the redo log record encoding
that was introduced in commit 7ae21b18a6
is not affected.
2020-02-18 12:08:33 +02:00
Marko Mäkelä
802a6b0a33 Reduce innodb_log_buffer_size 2020-02-18 10:54:56 +02:00
Marko Mäkelä
23de5b8f07 MDEV-21725 Optimize btr_page_reorganize_low() redo logging
btr_page_reorganize_low(): Log only the changed data in the page.

TODO: Do not copy the entire changed payload to the redo log.
Emit a combination of MEMMOVE and WRITE records to reduce the log volume.
2020-02-18 10:54:28 +02:00
Marko Mäkelä
41fe972db7 MDEV-21744 Assertion `!rec_offs_nth_sql_null(offsets, n)' failed
commit 08ba388713 of MDEV-12353
introduced an incorrect assumption, which was documented by
the failing assertion.

After instant ADD COLUMN, we can have a null (and in-place) UPDATE
of NULL to NULL. No data needs to be written for such updates.

For ROW_FORMAT=REDUNDANT, we reserve space for the NULL values,
and to be compatible with existing behaviour, we will zerofill
the unused data bytes when updating to NULL value.
2020-02-17 15:32:24 +02:00
Marko Mäkelä
055ce75d8b MDEV-21174: Correct a debug assertion failure
trx_purge_free_segment(): In some cases (observed when running
the test innodb_zip.wl5522_debug_zip), there is no change to
the TRX_UNDO_NEEDS_PURGE field. Add mtr_t::OPT to disable a debug check.

The bogus debug check was introduced in
commit 56f6dab1d0.
2020-02-17 15:32:24 +02:00
Marko Mäkelä
22f649a67a MDEV-12353: Reformat page_delete_rec_list_end()
We add FIXME comments and some sketch code for the following cases:

It is possible to write considerably less log for ROW_FORMAT=COMPRESSED
pages. For now, we will delete the records one by one.

It is also possible to treat 'deleting the last records' as a special
case that would involve shrinking PAGE_HEAP_TOP. That should reduce
the need of reorganizing pages.
2020-02-17 15:32:24 +02:00
Marko Mäkelä
09feb176e9 MDEV-12353: Optimize page_cur_delete_rec() logging further
page_mem_free(): When deleting the very last record of the page,
even if the record did not fully utilize all bytes in a
former PAGE_FREE record, truncate the PAGE_HEAP_TOP and reduce
PAGE_GARBAGE by the saved amount.
2020-02-17 15:32:24 +02:00
Ian Gilfillan
0683c8f7a2
Clarify, spelling for wsrep_strict_ddl description (#1447) 2020-02-17 13:32:36 +02:00
Marko Mäkelä
fc87698048 MDEV-12353: Write less log for BLOB pages
fsp_page_create(): Always initialize the page. The logic to
avoid initialization was made redundant and should have been removed
in mysql/mysql-server@ce0a1e85e2
(MySQL 5.7.5).

btr_store_big_rec_extern_fields(): Remove the redundant initialization
of FIL_PAGE_PREV and FIL_PAGE_NEXT. An INIT_PAGE record will have
been written already. Only write the ROW_FORMAT=COMPRESSED page payload
from FIL_PAGE_DATA onwards. We were unnecessarily writing from
FIL_PAGE_TYPE onwards, which caused an assertion failure on recovery:

	recv_sys_t::alloc(size_t): Assertion 'len <= srv_page_size' failed

when running the following tests:

	./mtr --no-reorder innodb_zip.blob,4k innodb_zip.bug56680,4k
2020-02-17 10:13:32 +02:00
Marko Mäkelä
5874aac71f MDEV-12353: Fix a Galera assertion failure
trx_rseg_write_wsrep_checkpoint(): Add missing mtr_t::OPT,
and avoid an unnecessary call to mtr_t::memset().

This addresses a debug assertion failure in wsrep_info.plugin.
2020-02-16 17:22:28 +02:00
Marko Mäkelä
d657cd7465 MDEV-12353: Optimize page_delete_rec_list_end() logging 2020-02-16 15:45:12 +02:00
Marko Mäkelä
5876de19d0 MDEV-12353: Remove bogus conditions
page_update_max_trx_id(), page_delete_rec_list_end(): Remove conditions
on recv_recovery_is_on(). These conditions should have been removed in
or before commit f8a9f90667
(removing the support for crash-upgrade).

The physical redo log based recovery will not call such high-level code.
2020-02-16 15:09:01 +02:00
Marko Mäkelä
3887daf826 MDEV-12353: Optimize page_cur_delete_rec() logging
page_mem_free(): When deleting the last record of a page,
do not add it to the PAGE_FREE list, but instead truncate the
PAGE_HEAP_TOP. Modify the page header fields by writing fewer
records.

page_cur_delete_rec(): Let page_mem_free() reset the PAGE_LAST_INSERT.

page_header_reset_last_insert(): Issue memset(), not memcpy(), for
the ROW_FORMAT=COMPRESSED page.
2020-02-16 14:10:26 +02:00
Daniel Bartholomew
2c34315df6
bump the VERSION 2020-02-14 10:46:08 -05:00
Marko Mäkelä
444c83b2ac MDEV-12353: Test InnoDB upgrade from multi-file redo log 2020-02-14 14:46:44 +02:00
Eugene Kosov
735c6ea3e6 fix Win build 2020-02-14 15:45:18 +03:00
Eugene Kosov
3daef523af MDEV-17084 Optimize append only files for NVDIMM
Optionally use libpmem for InnoDB redo log writing.

When server is built -DWITH_PMEM=ON InnoDB tries to detect
that redo log is located on persistent memory storage and
uses faster file access method.

When server is built with -DWITH_PMEM=OFF preprocessor is
used to ensure that no slowdown will present due to allocations
and virtual function calls. So, we don't slow down server
in a common case.

mapped_file_t: an map file, unmap file and returns mapped memory buffer

file_io: abstraction around memory mapped files and file descriptors.
Allows writing, reading and flushing to files.

file_io::writes_are_durable(): notable method of a class.
When it returns true writes are flushed immediately.

file_os_io: file descriptor based file access. Depends on a global state
like srv_read_only_mode

file_pmem_io: file access via libpmem

This is a collaboration work with Sergey Vojtovich
2020-02-14 14:11:10 +03:00
Marko Mäkelä
d901919db2 MDEV-19747: Fix a warning
In commit fc2f2fa853
we replaced FlushObserver* with bool, but forgot to
replace one NULL with false.
2020-02-14 11:03:11 +02:00
Marko Mäkelä
37dc087f58 MDEV-12353: Remove bogus comments and clean up code
This is a fixup for commit 7ae21b18a6.

It turns out that even if we in the future made LSN
count mini-transactions instead of bytes, we will need
both start LSN and end LSN, which must exactly match
between mtr_t::commit() and log_phys_t::apply().

log_rec_t::lsn: Restore the const qualifier.

log_phys_t::append(): Remove the lsn parameter. Both the start
and end LSN must remain unchanged. We can only append log from
the same mini-transaction to a single log record snippet.
If we combined the log from mini-transactions A and B, it could
happen that the FIL_PAGE_LSN of the page is somewhere between
A.start_lsn and B.start_lsn. In that case, also the log of B
would be wrongly skipped.

recv_sys_t::add(): Assert that if the start LSN matches, also
the end LSN will match.
2020-02-14 10:57:52 +02:00