Commit graph

22653 commits

Author SHA1 Message Date
Marko Mäkelä
0308de94ee MDEV-17138 follow-up: Optimize fseg_create()
fseg_create(): Initialize FSEG_FRAG_ARRY by a single MLOG_MEMSET record.

flst_zero_addr(), flst_init(): Optimize away redundant writes.

fseg_free_page_low(): Write FIL_NULL by MLOG_MEMSET.
2019-11-11 15:13:23 +02:00
Marko Mäkelä
3da895a736 Merge 10.3 into 10.4 2019-11-11 15:03:46 +02:00
Marko Mäkelä
4fcfdb60e7 Merge 10.2 into 10.3 2019-11-11 14:56:51 +02:00
Marko Mäkelä
142442d571 MDEV-21024: Cleanup XDES_CLEAN_BIT
The XDES_CLEAN_BIT is always set for every element of
the page allocation bitmap in the extent descriptor pages.
Do not bother touching it, to avoid redundant writes.
2019-11-11 14:18:50 +02:00
Marko Mäkelä
878bc854d9 MDEV-21024: Clean up dict_hdr_create()
The DICT_HDR_MAX_SPACE_ID was already zero-initialized at page allocation.
2019-11-11 14:15:04 +02:00
Marko Mäkelä
33f74e8fcf MDEV-21024: Clean up IMPORT TABLESPACE
page_rec_write_field(): Remove.

dict_create_index_tree_step(): If the SYS_INDEXES.PAGE does not change,
do not update it in the data dictionary. Typically, all index page numbers
would be unchanged before and after IMPORT TABLESPACE, except if some
secondary indexes were created after loading some data.

btr_root_fseg_adjust_on_import(): Remove the redundant mtr_t* parameter.
Redo logging is disabled during the page adjustments that IMPORT TABLESPACE
is performing.
2019-11-11 14:14:26 +02:00
Marko Mäkelä
dfdd96214b MDEV-21024: Clean up btr_root_raise_and_insert()
The root page must never have any siblings, so it is unnecessary
to clear those fields.
2019-11-11 14:14:26 +02:00
Marko Mäkelä
fc2ca2be4e MDEV-21024: Clean up page allocation
fsp_alloc_seg_inode_page(): Ever since
commit 3926673ce7
all newly allocated pages are zero-initialized.
Assert that this is the case for the FSEG_ID fields.
2019-11-11 14:14:26 +02:00
Marko Mäkelä
98e1d603bf MDEV-21024: Optimize writing BTR_EXTERN_LEN
btr_store_big_rec_extern_fields(): Remove the redundant initialization
of the most significant 32 bits of BTR_EXTERN_LEN. InnoDB never supported
BLOBs that are longer than 4GiB. In fact, dtuple_convert_big_rec()
would write emit an error message if a clustered index record tuple would
exceed 1,000,000,000 bytes in length.

The BTR_EXTERN_LEN in the BLOB pointers in clustered index leaf page
records is zero-initialized at least since
commit 41bb3537ba
2019-11-11 14:14:26 +02:00
Marko Mäkelä
3621df70ca MDEV-21024: Clean up rtr_adjust_upper_level()
Remove the unnecessary retrieval and null-modifications of
the preceding page.
2019-11-11 14:14:20 +02:00
Marko Mäkelä
29d67d051a Cleanup btr_page_get_prev(), btr_page_get_next()
Remove the redundant parameter mtr_t*.

Make use of page_has_prev(), page_has_next() whenever possible.
2019-11-11 13:36:21 +02:00
Marko Mäkelä
1d2458f813 MDEV-21024: Clean up rtr_adjust_upper_level()
Remove the unnecessary retrieval and null-modifications of
the preceding page.
2019-11-11 13:26:19 +02:00
Marko Mäkelä
bce71a2909 Cleanup: Replace xdes_set_bit()
The XDES_CLEAN_BIT is always set for every element of
the page allocation bitmap in the extent descriptor pages.
Do not bother touching it, to avoid redundant writes.

xdes_set_free<bool free>(): Replaces xdes_set_bit().
2019-11-08 13:45:03 +02:00
Marko Mäkelä
5ed54e78ac Cleanup: Remove redundant XDES_FREE_BIT parameters
The page allocation bitmaps in the extent descriptor pages
contain two bits per page: XDES_FREE_BIT and XDES_CLEAN_BIT,
which is unused. Simplify read access.

xdes_is_free(descr,mtr): Remove. Use !xdes_get_n_used(descr) instead.

xdes_is_free(): Replaces xdes_get_bit(), xdes_mtr_get_bit().

xdes_find_free(): Replaces xdes_find_bit().

fsp_seg_inode_page_get_nth_inode(): Remove the redundant parameters
physical_size, mtr.

fsp_seg_inode_page_find_used(), fsp_seg_inode_page_find_free():
Remove the redundant parameter mtr.
2019-11-08 13:45:02 +02:00
Marko Mäkelä
74b7d0182d Merge 10.4 into 10.5 2019-11-08 13:43:45 +02:00
Marko Mäkelä
b5ef7ffa59 Use uint16_t for FIL_PAGE_TYPE
Since commit 5d596064d6
fil_page_type_is_index() expects uint16_t, not ulint.
2019-11-08 13:43:42 +02:00
Marko Mäkelä
15b713cadc MDEV-17138 follow-up: Use MLOG_MEMSET in xdes_init() 2019-11-08 13:36:20 +02:00
Marko Mäkelä
a6d614fb4a MDEV-12353 preparation: Remove redundant writes
fsp_alloc_seg_inode_page(): Ever since
commit 3926673ce7
all newly allocated pages are zero-initialized.
Assert that this is the case for the FSEG_ID fields.
(Side note: before that fix, other parts of the pages
could contain nonzero garbage.)

btr_store_big_rec_extern_fields(): Remove the redundant initialization
of the most significant 32 bits of BTR_EXTERN_LEN. InnoDB never supported
BLOBs that are longer than 4GiB. In fact, dtuple_convert_big_rec()
would write emit an error message if a clustered index record tuple would
exceed 1,000,000,000 bytes in length.
2019-11-08 11:04:26 +02:00
Marko Mäkelä
5b72e8136f Cleanup: Do not pass mtr_t* as NULL
PageConverter::update_index_page(): Invoke lower-level writes directly.
2019-11-08 09:44:08 +02:00
Marko Mäkelä
5d596064d6 Cleanup: Define FIL_PAGE_TYPE constants as constexpr 2019-11-08 09:44:08 +02:00
Marko Mäkelä
52246dff2c Merge 10.4 into 10.5 2019-11-08 09:43:41 +02:00
Marko Mäkelä
78d0d2cdc5 Cleanup: Remove mach_read_ulint()
The function mach_read_ulint() is a wrapper for the lower-level
functions mach_read_from_1(), mach_read_from_2(), mach_read_from_8().
Invoke those functions directly, for better readability of the code.

mtr_t::read_ulint(), mtr_read_ulint(): Remove. Yes, we will lose the
ability to assert that the read is covered by the mini-transaction.
We would still check that on writes, and any writes that
wrongly bypass mini-transaction logging would likely be caught by
stress testing with Mariabackup.
2019-11-08 09:41:06 +02:00
Marko Mäkelä
8a5eb4141b MDEV-17138 follow-up: Use MLOG_MEMSET for writing FIL_NULL
Always use the MLOG_MEMSET record for writing FIL_NULL,
because it is more compact.
2019-11-08 09:00:10 +02:00
Marko Mäkelä
77e8a311e1 Merge 10.4 into 10.5
A conflict between MDEV-19514 (b42294bc64)
and MDEV-20934 (d7a2401750)
was resolved. We will not invoke the function ibuf_delete_recs()
from ibuf_merge_or_delete_for_page(). Instead, we will add that
logic to the function ibuf_read_merge_pages().
2019-11-07 10:34:33 +02:00
Oleksandr Byelkin
3ad37ed0eb Merge 10.4 into 10.5 2019-11-07 08:52:30 +01:00
Marko Mäkelä
928abd6967 Merge 10.3 into 10.4 2019-11-06 13:44:56 +02:00
Marko Mäkelä
908ca4668d Merge 10.2 into 10.3 2019-11-06 13:14:31 +02:00
Marko Mäkelä
90451a5981 Follow-up to 792c9f9a49
dict_index_add_to_cache(): Make the 'index' a reference to a pointer,
so that the caller will avoid the expensive call to
dict_index_get_if_in_cache_low().
2019-11-06 13:01:34 +02:00
Marko Mäkelä
8688ef22c2 Merge 10.1 to 10.2 2019-11-06 10:18:51 +02:00
Marko Mäkelä
d7a2401750 MDEV-20934 Infinite loop on innodb_fast_shutdown=0 with inconsistent change buffer
Due to a data corruption bug that may have occurred a long time earlier
(possibly involving physical backup and MySQL Bug #69122, which was
addressed in commit f166ec71b7)
it seems possible that the InnoDB change buffer might end up containing
entries, while no buffered changes exist according to the change buffer
bitmap pages in the .ibd files.

ibuf_delete_recs(): New function, to be invoked on slow shutdown only.
Remove all buffered changes for a specific page.

ibuf_merge_or_delete_for_page(): If the change buffer bitmap is clean
and a slow shutdown is in progress, invoke ibuf_delete_recs().
We do not want to do that during normal operation, due to the additional
overhead that is involved. The bitmap page should be consistent with
the change buffer in the first place.
2019-11-06 08:48:48 +02:00
Marko Mäkelä
4e99e67c4e Merge 5.5 into 10.1 2019-11-06 08:17:03 +02:00
Thirunarayanan Balathandayuthapani
5c3bbbd845 MDEV-20987 InnoDB fails to start when fts table has FK relation
InnoDB: Assertion failure in file .../dict/dict0dict.cc line ...
InnoDB: Failing assertion: table->can_be_evicted

This fixes a regression that was caused by the fix of MDEV-20621
(commit a41d429765).
MySQL 5.6 (and MariaDB 10.0) introduced eviction of tables from
the InnoDB data dictionary cache. Tables that are connected to
FOREIGN KEY constraints or FULLTEXT INDEX are exempt of the eviction.
With the problematic change, a table that would already be exempt
from eviction due to FOREIGN KEY would cause the problem if there
also was a FULLTEXT INDEX defined on it.

dict_load_table(): Only prevent eviction if table->can_be_evicted holds.
2019-11-06 08:12:00 +02:00
Sergei Golubchik
cd156e2c3e MDEV-20971 ASAN heap-use-after-free in list_delete / heap_close
Don't save/restore HP_INFO as it could be changed by a concurrent thread.
different parts of HP_INFO are protected by different mutexes and
the mutex that protect most of the HP_INFO does not protect its open_list
data.

As a bonus, make heap_check_heap() to take const HP_INFO* and not
make any changes there whatsoever.
2019-11-04 23:14:27 +01:00
Marko Mäkelä
51fb39bf17 MDEV-19586: Restore pointer indirection for recv_t::data
Something was wrong with the removal of pointer indirection,
because on 32-bit Windows we got crash recovery failures.
Curiously, WITH_ASAN of a 32-bit debug build did not notice anything.

This reverts a part of commit b7fc2c899e.

We have a 2MiB recv_sys.buf for the initial buffering. The minimum size
of log_sys.buf would be 16MiB, and that buffer should be practically
unused during recovery. If the buffer pool size is measured in gigabytes,
it would indeed make sense to use the buffer pool for the recovered log
records, perhaps after we have run out of log_sys.buf.

FIXME: allow the entire buf_block_t::frame to be used for buffered
log records, and remove MEM_HEAP_FOR_RECV_SYS. For example, use
buf_page_t::list or buf_page_t::LRU for keeping track of memory that
was allocated for recovery? Most members of buf_block_t
(except buf_block_t::frame) are unused when
block->page.state == BUF_BLOCK_MEMORY.
2019-11-04 16:13:43 +02:00
Marko Mäkelä
5164f8c206 Fix GCC 9.2.1 -Wstringop-truncation
dict_table_rename_in_cache(): Use strcpy() instead of strncpy(),
because they are known to be equivalent in this case (the length
of old_name was already validated).

mariabackup: Invoke strncpy() with one less than the buffer size,
and explicitly add NUL as the last byte of the buffer.
2019-11-04 15:52:54 +02:00
Marko Mäkelä
f89436b592 MDEV-18115: Remove a unused variable 2019-11-04 15:11:51 +02:00
Marko Mäkelä
541b00a3ba MDEV-19586: Clean up recv_t a little
recv_t, recv_t::data_t: Define constructors that copy the log records

Ideally, we should remove recv_sys.buf, RECV_DATA_BLOCK_SIZE,
and recv_sys_justify_left_parsing_buf(), and let the
recv_sys.pages point directly to a buffer of parsed redo log
records.

The RECV_PARSING_BUF_SIZE (size of recv_sys.buf) is only 2MiB,
while the minimum innodb_log_buffer_size (size of log_sys.buf) is 16MiB,
and log_sys.buf is unused during redo log apply!
2019-11-04 09:30:53 +02:00
Marko Mäkelä
64a02e4fa2 MDEV-19586: Add const qualifiers
Except for fil_name_process(), which invokes os_normalize_path(),
the redo log record parser will not modify the redo log records.
Add const qualifiers accordingly.
2019-11-04 09:25:26 +02:00
Sergei Golubchik
3ef01d1118 compilation failure, gcc 8.3.0
storage/innobase/log/log0recv.cc|1760 col 35 error| 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct recv_t' with no trivial copy-assignment [-Werror=class-memaccess]
2019-11-03 12:11:23 +01:00
pkubaj
eb56339b66 Fix build on !glibc/powerpc*
Do the same that newer branches do and don't include glibc-related headers on non-glibc environment.
2019-11-02 18:25:12 +04:00
Oleksandr Byelkin
6818f40adf Postmerge fix of rocksdb test results 2019-11-02 08:40:43 +01:00
Oleksandr Byelkin
f566889a79 Merge branch '10.3' into 10.4 2019-11-01 20:01:44 +01:00
Sergei Petrunia
9c6fec88b1 MDEV-17171: RocksDB Tables do not have "Creation Date"
- Add SLEEP() calls to the testcase to make it really test that the
  time doesn't change.
- Always use .frm file creation time as a creation timestamp (attempts
  to re-use older create_time when the table DDL changes are not good
  because then create_time will change after server restart)
- Use the same method names as the upstream patch does
- Use std::atomic for m_update_time
2019-11-01 21:40:10 +03:00
Marko Mäkelä
e5fed3b94d MDEV-19586: Avoid std::map::emplace()
GCC 4.7 only knows about std::map::insert(), not emplace().

Also, reformat the function in the common style.
2019-11-01 16:56:44 +02:00
Marko Mäkelä
ec40980ddd Merge 10.3 into 10.4 2019-11-01 15:23:18 +02:00
Marko Mäkelä
b7fc2c899e Refactor recv_sys_t::recs_t into page_recv_t
page_recv_t: Replaces recv_sys_t::recs_t.
page_recv_t::state is not private, even though some accessors exist.

page_recv_t::log: A singly-linked list of log_rec_t* with STL decoration
and the custom operations trim() and append(). The list members are private.

recv_t::data_t: Replaces recv_data_t.

recv_t::data: Remove the pointer indirection for the first log chunk,
and copy the first chunk directly after the record. Adjust the
definition of RECV_DATA_BLOCK_SIZE accordingly.
2019-11-01 15:06:31 +02:00
Marko Mäkelä
2aa1f77ef1 MDEV-19586: Rename recv_sys.empty() to recv_sys.clear()
In the collections of Standard Template Library,
empty() is a predicate and clear() empties a collection.
Let us rename recv_sys.empty() to recv_sys.clear() to avoid confusion.
2019-11-01 14:12:55 +02:00
Eugene Kosov
0b1bc4bf76 cleanup: replace some mtr_read_ulint() with mach_read_from_4() 2019-11-01 14:31:26 +03:00
Eugene Kosov
792c9f9a49 cleanup: get rid of dict_index_add_to_cache_w_vcol()
dict_index_add_to_cache_w_vcol(): merge with dict_index_add_to_cache()
2019-11-01 14:21:29 +03:00
Sergei Petrunia
9c72963d2a MDEV-17171: RocksDB Tables do not have "Creation Date"
Variant#5 of the patch:
- take creation date from the .frm file, like InnoDB does
- Update_time is in-memory only (like in InnoDB).
2019-11-01 08:57:56 +01:00
Thirunarayanan Balathandayuthapani
162f475c4b MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
innobase_drop_foreign_try(): Don't evict and reload the dict_foreign_t
during instant ALTER TABLE if the FOREIGN KEY constraint is being
dropped.

The MDEV-19630 fix (commit 07b1a26c33)
was incomplete, because it did not cover a case where the
FOREIGN KEY constraint is being dropped.
2019-11-01 08:33:59 +02:00
Sergei Petrunia
fcd65b0376 MDEV-17171: RocksDB Tables do not have "Creation Date"
Variant#5 of the patch:
- take creation date from the .frm file, like InnoDB does
- Update_time is in-memory only (like in InnoDB).
2019-10-31 19:45:25 +03:00
Sergei Petrunia
eafc9d8516 MDEV-17171: RocksDB Tables do not have "Creation Date"
Temporarily revert the patch
2019-10-31 19:45:25 +03:00
Oleksandr Byelkin
55b2281a5d Merge branch '10.2' into 10.3 2019-10-31 10:58:06 +01:00
Oleksandr Byelkin
259edb1f60 Merge branch '10.1' into 10.2 2019-10-31 09:07:26 +01:00
Marko Mäkelä
1bb857089f MDEV-20927: Remove duplicated code
In commit d1e6b0bcff
some code was supposed to be modified, but instead
it got duplicated. Remove the duplicated copy.
2019-10-31 07:44:18 +02:00
Oleksandr Byelkin
6680b04961 Merge remote-tracking branch 'connect/10.2' into 10.2 2019-10-30 21:56:35 +01:00
Oleksandr Byelkin
36f67a7dff Merge branch '10.1' into 10.2 2019-10-30 21:33:01 +01:00
Oleksandr Byelkin
d671f506b0 Merge branch '5.5' into 10.1 2019-10-30 14:47:35 +01:00
Monty
82b62924d7 Fixed wrong result files in test suite 2019-10-30 14:59:04 +02:00
Oleksandr Byelkin
708d46158b Merge remote-tracking branch 'connect/10.1' into 10.1 2019-10-30 13:55:35 +01:00
Oleksandr Byelkin
b58c38a3a9 Merge branch 'merge-tokudb-5.6' into 10.1 2019-10-30 13:49:25 +01:00
Marko Mäkelä
d03a59c6ff XtraDB 5.6.45-86.1 2019-10-30 13:21:36 +02:00
Marko Mäkelä
d1e6b0bcff MDEV-20927 Duplicate key with auto increment
Apply the changes to InnoDB and XtraDB that had been
inadvertently skipped in the merge
commit ae476868a5

That merge failure sabotaged part of MDEV-20127:
>Revert a problematic auto_increment_increment 'fix' from 2014.
>This involves replacing the MDEV-8827 fix and in 10.1,
>removing some WSREP instrumentation.

The code changes were re-merged manually by executing the following:

 # Get the parent of the problematic merge.
git checkout ae476868a5394041a00e75a29c7d45917e8dfae8^
 # Perform the merge again.
git merge ae476868a5394041a00e75a29c7d45917e8dfae8^2
 # Get the conflict resolution from that merge.
git checkout ae476868a5 .
 # Note: Any changes to these files were removed (empty diff)!
git diff HEAD storage/{innobase,xtradb}/handler/ha_innodb.cc
 # Apply the code changes:
git diff cf40393471b10ca68cc1d2804c22ab9203900978^2..MERGE_HEAD \
storage/{innobase,xtradb}/handler/ha_innodb.cc|
patch -p1
2019-10-30 13:21:36 +02:00
Oleksandr Byelkin
a3553a1387 5.6.45-86.1 2019-10-30 11:15:05 +01:00
Sergey Vojtovich
afb4878703 MDEV-18783 - Server crash in hp_rb_make_key
In debug build, whenever MEMORY table instance gets closed it performs
consistency check without protection. It may cause server crash if
executed concurrently with DML.

Moved consistency check to ha_heap::external_lock(F_UNLCK), so that it
is protected by THR_LOCK.
2019-10-30 12:52:19 +04:00
Jan Lindström
36a9694378 MDEV-18562 [ERROR] InnoDB: WSREP: referenced FK check fail: Lock wait index
Lock wait can happen on secondary index when doing FK checks for wsrep.
We should just return error to upper layer and applier will retry
operation when needed.
2019-10-30 10:14:56 +02:00
Marko Mäkelä
0ccfdc8eff Remove InnoDB wrappers of <string.h> functions
ut_strcmp(), ut_strcpy(), ut_strlen(), ut_memcpy(), ut_memcmp(),
ut_memmove(): Remove. Invoke the standard library functions directly.
2019-10-30 07:31:39 +02:00
Marko Mäkelä
44b0c86971 Clean up ut_strlcpy(), ut_strlcpy_rev()
ut_strlcpy(): Replace with the standard function strncpy().

ut_strlcpy_rev(): Define in the same compilation unit where
the only caller resides. Avoid unnecessary definition
in non-debug builds.
2019-10-30 06:42:51 +02:00
Eugene Kosov
9ed4d06706 Merge 5.5 into 10.1 2019-10-29 22:10:43 +03:00
Eugene Kosov
7440e61a64 MDEV-18115: Remove the only async write (of redo log)
TODO: do not use fil_* functions for redo log files.

log_t::checkpoint_lock: remove this lock which was used to wait for
async I/O completion.

checkpoint_lock_key
checkpoint_lock: remove now unneeded globals

log_write_checkpoint_info(): remove sync argument because all checkpoint
writes are synchronous now

log_write_checkpoint_info(): remove sync argument

log_group_checkpoint(): merge with the only caller

log_complete_checkpoint(): merge with the only caller

log_t::complete_checkpoint(): remove by merging with the only caller.
2019-10-29 22:03:02 +03:00
Eugene Kosov
84088d9458 add .clang-format file for InnoDB 2019-10-29 21:56:24 +03:00
Marko Mäkelä
576c96a938 MDEV-20917: Fix dict_table_t::instant_column()
This is the only 10.4-specific fix. The remaining known issues
will be fixed by merging commit bef843b97f
from 10.3.
2019-10-29 19:14:05 +02:00
Marko Mäkelä
bef843b97f MDEV-20917 InnoDB is passing NULL to nonnull function parameters
mem_heap_dup(): Avoid mem_heap_alloc() and memcpy() of data=NULL, len=0.

trx_undo_report_insert_virtual(), trx_undo_page_report_insert(),
trx_undo_page_report_modify(): Avoid memcpy(ptr, NULL, 0).

dfield_data_is_binary_equal(): Correctly handle data=NULL, len=0.

rec_init_offsets_temp(): Do allow def_val=NULL in the interface.

This clean-up was motivated by WITH_UBSAN, and no bug related to this
was observed in the wild. It should be noted that undefined behaviour
such as memcpy(ptr, NULL, 0) could allow compilers to perform unsafe
optimizations, like it was the case in
commit fc168c3a5e (MDEV-15587).
2019-10-29 18:20:32 +02:00
Marko Mäkelä
814534745b MDEV-20917 InnoDB is passing NULL to nonnull function parameters
mem_heap_dup(): Avoid mem_heap_alloc() and memcpy() of data=NULL, len=0.

trx_undo_report_insert_virtual(), trx_undo_page_report_insert(),
trx_undo_page_report_modify(): Avoid memcpy(ptr, NULL, 0).

dfield_data_is_binary_equal(): Correctly handle data=NULL, len=0.

This clean-up was motivated by WITH_UBSAN, and no bug related to this
was observed in the wild. It should be noted that undefined behaviour
such as memcpy(ptr, NULL, 0) could allow compilers to perform unsafe
optimizations, like it was the case in
commit fc168c3a5e (MDEV-15587).
2019-10-29 17:26:28 +02:00
Marko Mäkelä
2b710090aa Merge 10.4 into 10.5 2019-10-29 16:31:40 +02:00
Marko Mäkelä
d4e1fa39f0 Use C++11 "range for" in crash recovery code 2019-10-29 11:58:11 +02:00
Vladislav Vaintroub
2d82ae5ba3 MDEV-20825 : Innodb does not start if GetDiskFreeSpace() fails.
Ignore GetDiskFreeSpace() errors in os_file_get_status_win32
The call is only used to calculate filesystem block size, and this in
turn is only  shown in information_schema.sys_tablespaces.FS_BLOCK_SIZE.
There is no other use of this field, it does not affect any Innodb
functionality
2019-10-28 17:01:32 +00:00
Marko Mäkelä
613e9e7d4d MDEV-20907 Set innodb_log_files_in_group=1 by default
Historically, InnoDB split the redo log into at least 2 files.
MDEV-12061 allowed the minimum to be innodb_log_files_in_group=1,
but it kept the default at innodb_log_files_in_group=2.

Because performance seems to be slightly better with only one log file,
and because implementing an append-only variant of the log would require
a single file, let us define the default to be 1, and have
innodb_log_file_size=96M, to retain the same default total size.
2019-10-28 17:11:10 +02:00
Marko Mäkelä
3043f38436 Merge 10.4 into 10.5 2019-10-28 17:10:34 +02:00
Marko Mäkelä
d67ea8151f Rename LOG_HEADER_FORMAT_ to log_t::FORMAT_ 2019-10-28 16:16:57 +02:00
Sergei Golubchik
c13519312b MDEV-20799 DROP Virtual Column crashes MariaDB
use the correct table for evaluating virtual columns in the
InnoDB ALTER TABLE.
2019-10-28 08:40:48 +01:00
Sergei Golubchik
be780c0555 fix CONNECT engine to issue the correct error message 2019-10-28 08:17:56 +01:00
Marko Mäkelä
d752a97ebb Merge 10.1 to 10.2 2019-10-25 17:33:39 +03:00
Thirunarayanan Balathandayuthapani
a41d429765 MDEV-20621 FULLTEXT INDEX activity causes InnoDB hang
- fts_optimize_thread() uses dict_table_t object instead of table id.
So that it doesn't acquire dict_sys->mutex. It leads to remove the
hang of dict_sys->mutex between fts_optimize_thread() and other threads.

- in_queue to indicate whether the table is in fts_optimize_queue. It
is protected by fts_optimize_wq->mutex to avoid any race condition.

- fts_optimize_init() adds the fts table to the fts_optimize_wq
2019-10-25 16:27:41 +03:00
Thirunarayanan Balathandayuthapani
bd22650bbc MDEV-19073 FTS row mismatch after crash recovery
InnoDB stores synced_doc_id + 1 value in FTS_CONFIG table. But
while reading the synced doc id from FTS_CONFIG table after restart,
InnoDB should read synced_doc_id - 1 to get the actual synced
doc id value.
2019-10-25 16:17:59 +03:00
Marko Mäkelä
88cdfc5c7d MDEV-20487 Set innodb_adaptive_hash_index=OFF by default
Based on the performance testing that was conducted in MDEV-17492,
the InnoDB adaptive hash index could only help performance in specific,
almost-read-only workloads. It could slow down all kinds of workloads
(especially DROP TABLE, TRUNCATE TABLE, ALTER TABLE, or DROP INDEX
operations), and it can become corrupted, causing crashes (such as
MDEV-18815, MDEV-20203) and possibly data corruption. Furthermore,
the adaptive hash index consumes space from the InnoDB buffer pool,
which could hurt performance when the working set would almost fit
in the buffer pool.

Given all this, it is best to disable the adaptive hash index by default.
2019-10-23 17:43:31 +03:00
Monty
18a44b4b4b Don't crash in S3 if Aria is not initialzed 2019-10-20 12:16:52 +03:00
Monty
017150b747 Fixed compilation issue 2019-10-20 12:16:09 +03:00
Monty
7def2877e3 Write error message if aria_log.??????? files are missing
This can happen if one uses a backup where not all aria_log.* files
are copied or if the last one is too short. In this case the data
files will contain data that is not in the logs and recovery will fail.

Other things:
- Fixed tprint() to not print extra new line to debug trace
2019-10-20 11:52:29 +03:00
Marko Mäkelä
2809842031 MDEV-20864 Introduce debug option innodb_change_buffer_dump
To diagnose a hang in slow shutdown (innodb_fast_shutdown=0),
let us introduce a Boolean startup option in debug builds
that will cause the contents of the InnoDB change buffer
to be dumped to the server error log at startup.
2019-10-19 15:16:47 +03:00
Marko Mäkelä
0b9cee2cbf Merge 10.2 into 10.3 2019-10-18 09:05:27 +03:00
Marko Mäkelä
fa929f7cdf Simplify row_undo_ins_remove_sec_low()
Reduce the scope of some variables, remove a goto and a redundant
assertion.

For B-tree secondary indexes, this function can remove a delete-marked
purgeable record, in case a row rollback of the INSERT was initiated
due to an error in an earlier secondary index.
2019-10-17 17:12:23 +03:00
Marko Mäkelä
b027830232 MDEV-20850 Merge new release of InnoDB 5.7.28 to 10.2 2019-10-17 17:08:58 +03:00
Marko Mäkelä
fa32d28f2f MDEV-20852 BtrBulk is unnecessarily holding dict_index_t::lock
The BtrBulk class, which was introduced in MySQL 5.7, is by design
the exclusive writer to an index. It is therefore unnecessary to
acquire the dict_index_t::lock in that code.

Holding the dict_index_t::lock would unnecessarily block other threads
(SQL connections and the InnoDB purge threads) from buffering concurrent
modifications to being-created secondary indexes.

This fix is motivated by a change in MySQL 5.7.28:
Bug #29008298 MYSQLD CRASHES ITSELF WHEN CREATING INDEX
mysql/mysql-server@f9fb96c20f

PageBulk::init(), PageBulk::latch(): Never acquire m_index->lock.

PageBulk::storeExt(): Remove some pointer indirection, and improve
a debug assertion that seems to prove that some code is redundant.

BtrBulk::pageCommit(): Assert that m_index->lock is not being held.

btr_blob_log_check_t: Do not acquire m_index->lock if
m_op == BTR_STORE_INSERT_BULK. Add UNIV_UNLIKELY hints around
that condition.

btr_store_big_rec_extern_fields(): Allow index->lock not to be held
while op == BTR_STORE_INSERT_BULK. Add UNIV_UNLIKELY hints around
that condition.
2019-10-17 14:04:07 +03:00
Olivier Bertrand
a00b713130 Fix wrong second parameter in snprintf 2019-10-16 22:12:47 +02:00
Olivier Bertrand
b56589eaf2 Some small changes.
===================
- Fix unhandled throws, add some trace + typo
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/valblk.cpp
  modified:   storage/connect/value.cpp
2019-10-16 17:40:49 +02:00
Monty
3ce14a66ef Fixed bug in lock tables + alter table with Aria tables.
MDEV-18451 Server crashes in maria_create_trn_for_mysql
upon ALTER TABLE

Problem was that when table was locked many times, not all
instances where removed from the transaction by
_ma_remove_table_from_trnman()
2019-10-16 18:40:31 +03:00
Aleksey Midenkov
7ae0be25a6 MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 upon DELETE from versioned table with FK
MDEV-16210 original case was wrongly allowed versioned DELETE from
referenced table where reference is by non-primary key. InnoDB UPDATE
has optimization for new rows not changing its clustered index
position. In this case InnoDB doesn't update all secondary indexes and
misses the one holding the referenced key. The fix was to disable this
optimization for versioned DELETE. In case of versioned DELETE we
forcely update all secondary indexes and therefore check them for
constraints.

But the above fix raised another problem with versioned DELETE on
foreign table side. In case when there was no corresponding record in
referenced table (illegal foreign reference can be done with "set
foreign_key_checks=off") there was spurious constraint check (because
versioned DELETE is actually UPDATE) and hence the operation failed
with constraint error.

MDEV-16210 tried to fix the above problem by checking foreign table
instead of referenced table and that at least was illegal.

Constraint check is done by row_ins_check_foreign_constraint() no
matter what kind of table is checked, referenced or foreign
(controlled by check_ref argument).

Referenced table is checked by row_upd_check_references_constraints().
Foreign table is checked by row_ins_check_foreign_constraints().

Current fix rolls back the wrong fix for the above problem and
disables referenced table check for DELETE on foreign side by
introducing `check_foreign` argument which when set to *false* skips
row_ins_check_foreign_constraints() call.
2019-10-15 13:29:18 +03:00
Marko Mäkelä
f989c0ce66 MDEV-20813: Do not rotate keys for unallocated pages
fil_crypt_rotate_page(): Skip the key rotation for pages that carry 0
in FIL_PAGE_TYPE. This avoids not only unnecessary writes, but also
failures of the recently added debug assertion in
buf_flush_init_for_writing() that the FIL_PAGE_TYPE should be nonzero.

Note: the debug assertion can fail if the file was originally created
before MySQL 5.5. In old InnoDB versions, FIL_PAGE_TYPE was only
initialized for B-tree pages, to FIL_PAGE_INDEX. For any other pages,
the field could be garbage, including FIL_PAGE_INDEX. In MariaDB 10.2
and later, buf_flush_init_for_writing() would initialize the
FIL_PAGE_TYPE on such old pages, but only after passing the debug
assertion that insists that pages have a nonzero FIL_PAGE_TYPE.
Thus, the debug assertion at the start of buf_flush_init_for_writing()
can fail when upgrading from very old debug files. This assertion is
only present in debug builds, not release builds.
2019-10-14 17:26:21 +03:00