Commit graph

22271 commits

Author SHA1 Message Date
Aleksey Midenkov
cf7a8b9eb2 MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
Cause
Stale thd->m_stmt_da->m_sql_errno which is from different invocation.

Fix
Reset error state before attempt to open table.
2019-07-09 10:01:54 +03:00
Aleksey Midenkov
e91fb70f99 MDEV-19785 Storage CONNECT compilation error: unknown type name 'UNZFAM'
Another fail fix:

undefined reference to `ZipLoadFile`
2019-07-09 10:01:54 +03:00
Aleksey Midenkov
53dd0e4f75 MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
Cause
Stale thd->m_stmt_da->m_sql_errno which is from different invocation.

Fix
Reset error state before attempt to open table.
2019-07-08 20:14:51 +03:00
Aleksey Midenkov
0fe212a880 MDEV-19785 Storage CONNECT compilation error: unknown type name 'UNZFAM'
Another fail fix:

undefined reference to `ZipLoadFile`
2019-07-08 20:14:51 +03:00
Aleksey Midenkov
6974962945 MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
Cause
Stale thd->m_stmt_da->m_sql_errno which is from different invocation.

Fix
Reset error state before attempt to open table.
2019-07-08 14:55:59 +03:00
Aleksey Midenkov
1bb57e59a1 MDEV-19785 Storage CONNECT compilation error: unknown type name 'UNZFAM'
Another fail fix:

undefined reference to `ZipLoadFile`
2019-07-08 13:25:04 +03:00
Aleksey Midenkov
08baaa14b9 MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
Cause
Stale thd->m_stmt_da->m_sql_errno which is from different invocation.

Fix
Reset error state before attempt to open table.
2019-07-07 23:11:20 +03:00
Aleksey Midenkov
29ffaf405e MDEV-19785 Storage CONNECT compilation error: unknown type name 'UNZFAM'
Another fail fix:

undefined reference to `ZipLoadFile`
2019-07-07 23:11:20 +03:00
Sergei Petrunia
9abdf11ed1 Update RocksDB the revision that fixes the compile error on power8 2019-07-07 18:17:17 +03:00
Kentoku SHIBA
9d6b601e79
MDEV-19866 With a Spider table, a SELECT with WHERE involving primary key breaks following SELECTs (#1356)
Change checking scanning partitions from part_spec to part_info->read_partitions
2019-07-06 23:54:53 +09:00
Kentoku SHIBA
fa7051c419
MDEV-19842 Crash while creating statistics for Spider table (#1355)
Added checks of the number of columns of the system tables.
Move install_spider.sql into source code except installing Spider
2019-07-06 23:52:53 +09:00
Kentoku SHIBA
4a739d7650
MDEV-16248 Row based replication to spider with float column fails on delete/update (#1354) 2019-07-06 22:38:43 +09:00
Eugene Kosov
fb3998c351 fix build 2019-07-05 18:27:44 +03:00
Eugene Kosov
5ebef42238 MDEV-19292 "Row size too large" error when creating table with lots columns when row format is DYNAMIC or COMPRESSED
Basic idea of the patch: disallow creating tables which allow to create
rows which are too big to insert. In other words, if user created a table user
should never see an errors like 'can not insert row as it is too big for current
page size'.

SET innodb_strict_mode=OFF; will allow to create very long tables and only a
warning will be issued.

dict_table_t::get_overflow_field_local_len(): this function lets know a maximum
local field len for overflow fields for every file and row format.

innobase_check_column_length(): improve name to too_big_key_part_length()
and reuse in a different part of code.

create_table_info_t::prepare_create_table(): add check for maximum allowed
key part length to keep ALGORITHM=COPY behavior similar to ALGORITHM=INPLACE
behavior. Affected test is innodb.strict_mode

Rename dict_index_too_big_for_tree() to
dict_index_t::rec_potentially_too_big(): copy overflow-related size computation
from dtuple_convert_big_rec(). A lot of tests was changed because of that.
I wonder whether users will complain about it?

Test innodb.max_record_size tests dict_index_t::rec_potentially_too_big()
for different row formats and page sizes.
2019-07-05 17:02:21 +03:00
Eugene Kosov
c9aa495fb6 MDEV-19955 make argument of handler::ha_write_row() const
MDEV-19486 and one more similar bug appeared because handler::write_row() interface
welcomes to modify buffer by storage engine. But callers are not ready for that
thus bugs are possible in future.

handler::write_row():
handler::ha_write_row(): make argument const
2019-07-05 13:14:19 +03:00
Eugene Kosov
23c12ed5cb MDEV-19951 use override keyword across the InnoDB
Use on every virtual function override.

ha_innobase: mark a final

ha_innobase::bas_ext(): remove as unused

ha_innobase::get_cascade_foreign_key_table_list: remove as unused

ha_innobase::end_stmt(): merge into ha_innobase::reset()
2019-07-04 16:28:27 +03:00
Vladislav Vaintroub
4513e73e0f Remove os_aio_simulated_put_read_threads_to_sleep()
According to the code, it was Windows specific "simulated AIO"
workaround. The simulated s not supported on Windows anymore.

Thus, remove the dead code
2019-07-04 10:27:11 +02:00
Vladislav Vaintroub
bd917e0811 Fix clang-cl warnings 2019-07-04 10:27:10 +02:00
Alexander Barkov
9c9e0ac73d MDEV-19944 Remove GIS data types from keyword list in lex.h 2019-07-04 07:48:46 +04:00
Sergei Petrunia
c17b0b734c MDEV-19936: MyRocks: compile fails on Windows
(Cumulative diff, back-port to 10.2)
Remove other unneeded files which cause compile
warnings-treated-as-errors errors on Windows.
2019-07-04 00:53:07 +03:00
Marko Mäkelä
695230c067 MDEV-19940: Fix integer type mismatch 2019-07-04 00:42:40 +03:00
Marko Mäkelä
8773bee9f7 MDEV-18582: Fix the 32-bit build 2019-07-04 00:30:14 +03:00
Marko Mäkelä
412533b4a7 MDEV-18582: Extend SHOW STATUS LIKE 'Innodb_%'
Many InnoDB internal variables and counters were only exposed
in an unstructured fashion via SHOW ENGINE INNODB STATUS.

Expose more variables via SHOW STATUS. Many of these were
exported in XtraDB.

Also, introduce SHOW_SIZE_T and use the proper size for
exporting the InnoDB variables.

Remove some unnecessary indirection via export_vars, and
bind some variables directly.

dict_sys_t::rough_size(): Replaces dict_sys_get_size()
and includes the hash table sizes.

This is based on a contribution by Tony Liu from ServiceNow.
2019-07-04 00:09:16 +03:00
Marko Mäkelä
61e26289fc MDEV-18582 preparation: Allocate ibuf statically 2019-07-04 00:09:16 +03:00
Marko Mäkelä
d09aec7a15 MDEV-19940 Clean up INFORMATION_SCHEMA.INNODB_ tables
Shorten some VARCHAR attributes to a more reasonable length.

INNODB_METRICS: Rename the column STATUS to ENABLED, and make it Boolean.

Replace with INT(1) many Boolean attributes that were declared as VARCHAR
containing 'NO','YES','disabled','enabled','Uninitialized','Initialized'.

Replace some VARCHAR attributes with ENUM.

Replace some BIGINT with INT when 32 bits are sufficient.

Remove INNODB_SYS_TABLESPACES.SPACE_TYPE. The type of a tablespace
can be derived from the tablespace ID. A fixed number is used for
the system tablespace and the temporary tablespace. All other tablespaces
are single-table or single-partition tablespaces.

i_s_locks_row_t::lock_type, lock_get_type_str(): Remove.
This is a redundant field. Table and record locks can be
distinguished by whether i_s_locks_row_t::lock_index is NULL.

fill_trx_row(): Do not unnecessarily copy the constant strings that
trx->op_info is pointing to.

i_s_locks_row_t::lock_mode: Replace string with integer.

lock_get_mode_str(), lock_get_trx_id(), lock_get_trx(): Remove.

field_store_ulint(): Remove.
2019-07-04 00:09:16 +03:00
Sergei Petrunia
099007c3c9 MDEV-19936: MyRocks: compile fails on Windows
Part#2: Remove other unneeded files which cause compile
warnings-treated-as-errors errors on Windows.
2019-07-03 16:08:26 +03:00
Marko Mäkelä
24403da91a Remove unused const TABLE_HASH_SIZE 2019-07-03 14:42:04 +03:00
Robert Bindar
666730ee52 Fix gcc-8 warning in rocksdb 2019-07-03 14:32:24 +03:00
Sergei Petrunia
7d580ad141 MDEV-19936: MyRocks: compile fails on Windows
Don't compile table/mock_table.cc
(pushing this patch to 10.3 first to make sure it fixes the issue
will push to 10.2, too)
2019-07-03 10:58:40 +03:00
Marko Mäkelä
a946b36601 Fix the compilation after the parent commit
Up to MariaDB 10.2, field_name is still a C-style string.
2019-07-02 22:25:48 +03:00
Marko Mäkelä
7a3d34d645 Merge 10.3 into 10.4 2019-07-02 21:44:58 +03:00
Marko Mäkelä
1d45b3b055 Merge 10.2 into 10.3 2019-07-02 21:41:40 +03:00
Marko Mäkelä
c1cb5c17be MDEV-19869: Correct the logic, and avoid type mismatch 2019-07-02 21:40:34 +03:00
Marko Mäkelä
e82fe21e3a Merge 10.2 into 10.3 2019-07-02 17:46:22 +03:00
Marko Mäkelä
6bb922e58e MDEV-13626: Import and adjust innodb.blob-crash 2019-07-02 15:18:12 +03:00
Jan Lindström
b105427745 MDEV-19660: wsrep_rec_get_foreign_key() is dereferencing a stale pointer to a page that was previously latched
In row_ins_foreign_check_on_constraint(), clustered index record is being passed to wsrep_append_foreign_key() after releasing the latch. If a record has been changed by other thread in the meantime then it could lead to a crash when
wsrep_rec_get_foreign_key () tries to access the record.

row_ins_foreign_check_on_constraint
	Use cascade->pcur->old_rec instead of clust_rec.

row_ins_check_foreign_constraint
	Add missing error printout.
2019-07-02 10:06:13 +03:00
Thirunarayanan Balathandayuthapani
41f6e68878 MDEV-19781 Add page id matching check in innochecksum tool
- Changed the assert to ignore SRV_LOG_SPACE_FIRST_ID. Post push
fix to address the previous commit failure.
2019-07-01 21:58:20 +05:30
Marko Mäkelä
9c16460e63 Merge 10.3 into 10.4 2019-07-01 18:37:15 +03:00
Marko Mäkelä
0e1ba364a1 MDEV-19916 Corruption after instant ADD/DROP and shrinking the tree
btr_lift_page_up(): Correct the incorrect condition.

page_validate(): Validate the page type.
2019-07-01 18:24:54 +03:00
Marko Mäkelä
92bbf4f53d MDEV-19916: Improve page_validate()
page_validate(): Validate also the page type, and try to list all
errors that were encountered for the page, with a little more detail.
2019-07-01 18:24:35 +03:00
Thirunarayanan Balathandayuthapani
40c1f4bd4c MDEV-19781 Add page id matching check in innochecksum tool
Changed the debug insert inside fil_io() to check whether it writes
the page to wrong offset only for user tablespace.
2019-07-01 20:21:26 +05:30
Thirunarayanan Balathandayuthapani
dca9792a24 MDEV-17228 Encrypted temporary tables are not encrypted
- log_crypt_init() should be called from create_log_files(). Because
it should re-create the new random nonce compared to the old ones.
2019-07-01 18:50:44 +05:30
Marko Mäkelä
5a136d84f3 MDEV-19766: Disable page dump output in debug builds
The test innodb.leaf_page_corrupted_during_recovery
fails on buildbot with

Warning	1406	Data too long for column 'line' at row 10
line
 len 16384; hex ...

because of a page dumps that InnoDB is generating for a corrupted page

Since this test is using debug instrumentation, we will solve the
issue by disabling page dumps in debug builds altogether. Users of
debug builds will likely know how to extract page dumps in other means.

Page dump output could sometimes be useful when diagnosing problems
that users are facing. Hence we will keep the page dump output in
non-debug (release) builds.
2019-07-01 13:27:12 +03:00
Thirunarayanan Balathandayuthapani
85d0a1955f MDEV-19914 Server startup fails while dropping garbage encrypted tablespace if innodb_encryption_threads > 0
- Avoiding accessing encryption thread mutex before initiating
the encryption threads
2019-07-01 15:21:17 +05:30
Thirunarayanan Balathandayuthapani
ed6da51f3e MDEV-19869 Port innodb_fts.fulltext2 from mysql to mariadb.
- Ported mysql Bug#20597981 test case to mariadb-10.2
- InnoDB never used fts_doc_id_in_read_set. Basically it tells
innodb to read the fts_doc_id from the index record itself.
2019-07-01 13:46:56 +05:30
Vladislav Vaintroub
0179aad633 Windows, compiling : Reenable /MP for connect engine.
Remove this flag only from domdoc.cpp, which uses #import directive.
2019-06-30 17:48:19 +02:00
Kentoku SHIBA
76200870ea
MDEV-17204 Mariadb 10.3.9 Spider DB SQL Alias no execute (#1348) 2019-06-29 03:42:35 +09:00
Kentoku SHIBA
d4bdf1c0b6
MDEV-16508 spider: sql_mode not maintained between spider node and data nodes (#1347)
Add the following parameter.

- spider_sync_sql_mode
  Local sql_mode synchronous existence to remote server.
   0 : It doesn't synchronize.
   1 : It synchronizes.
  The default value is 1
2019-06-29 03:35:48 +09:00
Kentoku SHIBA
1635ea9474
MDEV-17402 slave_transaction_retry_errors="12701" won't be enabled (#1346)
error code 12701 is already included in default value, but other plugin specific error codes are ignored because of checking with ER_ERROR_LAST. ER_ERROR_LAST does not include plugin specific error codes. So I just removed it for fixing this issue.
2019-06-29 00:05:34 +09:00
Thirunarayanan Balathandayuthapani
723a4b1d78 MDEV-17228 Encrypted temporary tables are not encrypted
- Introduce a new variable called innodb_encrypt_temporary_tables which is
a boolean variable. It decides whether to encrypt the temporary tablespace.
- Encrypts the temporary tablespace based on full checksum format.
- Introduced a new counter to track encrypted and decrypted temporary
tablespace pages.
- Warnings issued if temporary table creation has conflict value with
innodb_encrypt_temporary_tables
- Added a new test case which reads and writes the pages from/to temporary
tablespace.
2019-06-28 19:07:59 +05:30
Thirunarayanan Balathandayuthapani
e4a0dbfb4a MDEV-19781 Add page id matching check in innochecksum tool
Added the condition in innochecksum tool to check page id mismatch.
This could catch the write corruption caused by InnoDB.

Added the debug insert inside fil_io() to check whether it writes
the page to wrong offset.
2019-06-28 18:58:52 +05:30
Alexander Barkov
3e7e87ddcc MDEV-19897 Rename source code variable names from utf8 to utf8mb3 2019-06-28 12:37:04 +04:00
Monty
f7a4a8719b MDEV-14996 kill during FLUSH TABLES FOR EXPORT causes assert 2019-06-27 20:57:25 +03:00
Monty
9053047f3d MDEV-17551 assert or crashed table when using blobs
The bug was that when long item-strings was converted to VARCHAR,
type_handler::string_type_handler() didn't take into account max
VARCHAR length.  The resulting Aria temporary table was created with
a VARCHAR field of length 1 when it should have been 65537. This caused
MariaDB to send impossible records to ma_write() and Aria reported
eventually the table as crashed.

Fixed by updating Type_handler::string_type_handler() to not create too long
VARCHAR fields. To make things extra safe, I also added checks in when
writing dynamic Aria records to ensure we find the wrong record during write
instead of during read.
2019-06-27 19:01:51 +03:00
Marko Mäkelä
b7b0bc8f11 Merge 10.3 into 10.4
We omit the work-around commit 0b7fa5a05d
because it appears to be needed for CentOS 6 only,
which we no longer support.
2019-06-27 17:54:47 +03:00
Marko Mäkelä
92feac53a6 MDEV-19886 InnoDB returns misleading ER_NO_SUCH_TABLE_IN_ENGINE
A fix in MySQL 5.7.6 was not completely merged to MariaDB:
Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND"
2019-06-27 15:39:04 +03:00
Marko Mäkelä
f5c080c735 MDEV-19845: Fix the build on some platforms
On some platforms, MY_RELAX_CPU() falls back to an atomic
memory operation, but my_cpu.h fails to include my_atomic.h.
2019-06-27 15:04:00 +03:00
Marko Mäkelä
042fc29597 MDEV-19845: Adaptive spin loops
Starting with the Intel Skylake microarchitecture, the PAUSE
instruction latency is about 140 clock cycles instead of earlier 10.
On AMD processors, the latency could be 10 or 50 clock cycles,
depending on microarchitecture.

Because of this big range of latency, let us scale the loops around
the PAUSE instruction based on timing results at server startup.

my_cpu_relax_multiplier: New variable: How many times to invoke PAUSE
in a loop. Only defined for IA-32 and AMD64.

my_cpu_init(): Determine with RDTSC the time to run 16 PAUSE instructions
in two unrolled loops according, and based on the quicker of the two
runs, initialize my_cpu_relax_multiplier. This form of calibration was
suggested by Mikhail Sinyavin from Intel.

LF_BACKOFF(), ut_delay(): Use my_cpu_relax_multiplier when available.

ut_delay(): Define inline in my_cpu.h.

UT_COMPILER_BARRIER(): Remove. This does not seem to have any effect,
because in our ut_delay() implementation, no computations are being
performed inside the loop. The purpose of UT_COMPILER_BARRIER() was to
prohibit the compiler from reordering computations. It was not
emitting any code.
2019-06-27 10:53:18 +03:00
Monty
1a41fc77dd Merge remote-tracking branch 'origin/10.4' into 10.5 2019-06-27 01:21:41 +03:00
Monty
8e2a24bb33 Added s3_protocol_version=auto 2019-06-26 23:39:13 +03:00
Monty
0765d823e4 Updated to latest libmarias3 to fix some compatiblity issues 2019-06-26 23:39:12 +03:00
Monty
f48943468f MDEV-19575 Fixed assert in ma_pagecache
There was a bug in the page cache that didn't take into account that
another thread could be waiting for a page to be read by read_big_block().
Fixed by releasing all waiters in read_big_block()
2019-06-26 23:39:12 +03:00
Monty
f44c687815 S3: Don't do discover in mysql database (makes boot faster and safer) 2019-06-26 23:32:30 +03:00
Monty
bb702c2e4c Limit minium aria_block_size to 4096
MDEV-19585  Assertion with S3 table and flush_tables

The limit has to be increased so that MariaDB can create system tables.
It should not have any notable impact on performance.

There should not be any notable performance differences between 1K and 4K,
especially for temporary tables. In most cases using bigger blocks is also
faster (with the possible exception of doing key reads of not fixed length
keys).
2019-06-26 20:41:44 +03:00
Eugene Kosov
12ce066edf MDEV-17441 InnoDB transition to C++11 atomics
os0once.h: remove as not used now
2019-06-26 13:12:30 +03:00
Eugene Kosov
adb640e25a MDEV-17441 InnoDB transition to C++11 atomics
zip_pad_info_t::mutex_created: remove along with corresponding stuff

zip_pad_info_t::mutex: make member value instead of a pointer
2019-06-26 13:12:29 +03:00
Eugene Kosov
52a5097764 MDEV-17441 InnoDB transition to C++11 atomics
dict_table_t::stats_latch_created: remove along with related stuff

dict_table_t::stats_latch: make value member, not pointer. And always lock this
for simplicity, even to stats cloned table.

based on the work of Sergey Vojtovich
2019-06-26 13:12:29 +03:00
Sergey Vojtovich
e9a5f288f2 MDEV-17441 - InnoDB transition to C++11 atomics
Get rid of os_once.
2019-06-26 13:12:29 +03:00
Vlad Lesin
878ad986fd MDEV-19464: Altering partitioned table into S3 causes an obscure error
The error occured because aria_copy_to_s3() function tried to copy .frm file
of partition, but partition does not have it's own .frm file. The same is true
for aria_rename_s3().

To fix this issue the new parameter was added to those two functions to specify
if .frm file must be copied or not. The parameter is set to 'false' for
partitions.

Also there was other issue with EXCHANGE PARTITION. Briefly, there is the
following sequence of operations(see  exchange_name_with_ddl_log() for details):
1) rename swap table to temporary table,
2) rename partition to swap table,
3) rename temporary table to partition.

On step (1) .frm file is renamed too. On step (2) the swap table does not
have .frm file, as partition does not have it. On step (3) partition will have
.frm file, because it will be renamed from temporary table. All of this causes
error on different stages of the table access. To fix it, .frm is not touched
at all for s3 during EXCHANGE PARTITION operation. This is implemented in
ha_s3::rename_table() by additional checking of
current_thd->lex->alter_info.partition_flags(see also ALTER_PARTITION_EXCHANGE
in sql_yacc.yy).
2019-06-26 13:01:32 +03:00
Alexander Barkov
6f3612fa4d MDEV-19861 Add intfastructure to have ENUM columns in INFORMATION_SCHEMA 2019-06-26 06:46:55 +04:00
Igor Babaev
1a518aa1d2 MDEV-19820 Wrong result with multiple single column index request
The bug occured when the optimizer decided to use a rowid filter built
by a range index scan to access an InnoDB table with generated clustered
index.
When a table is accessed by a secondary index Idx employing a rowid filter the
the value of pk contained in the found index tuple is checked against the
filter. A call of the handler function position is supposed to put the
pk value into the handler::ref buffer. However for generated clustered
primary keys it did not happened. The patch fixes this problem.
2019-06-25 08:06:39 -07:00
Monty
7a2958f456 MDEV-17576 Assertion in maria_extra upon ALTER on table with triggers and locks
The problem was that the code in maria_extra assumed that there could be
only one table open when doing maria_extra(MA_FORCE_REOPEN)
However in the case of triggers, there can be multiple copies of
the table open.

Fixed by removing assert.
2019-06-25 16:17:29 +03:00
Eugene Kosov
d36c107a6b imporve clang build
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug

Maintainer mode makes all warnings errors. This patch fix warnings. Mostly about
deprecated `register` keyword.

Too much warnings came from Mroonga and I gave up on it.
2019-06-25 13:21:36 +03:00
Monty
8d4c159b1b Added s3_debug to be able to debug s3 connections 2019-06-25 13:09:06 +03:00
Michael Widenius
d78145459f Fixed Aria recovery progress printing
- When recovery failed, errors would not be printed on
  new lines.
- Print more information if file lengths are changed
- Added logging of table name for entries INCOMPLETE_LOG and
  REDO_REPAIR_TABLE
2019-06-25 12:07:50 +03:00
Michael Widenius
793e5be770 Give a readable error if aria_log page numbers doesn't match
MDEV-18461 Aria crash recovery failures

This does not fix the bug reported in the MDEV, but
now we get an error message of the problem instead of
an assert.
2019-06-25 12:07:50 +03:00
Michael Widenius
204434f2d0 Backport aria usage if LSN_FMT from 10.3
This helps when merging code between releases
2019-06-25 12:07:50 +03:00
Marko Mäkelä
6ffaed615a Remove the unused function maria_clone 2019-06-24 14:31:49 +03:00
Monty
e6297bbe37 Updated to latest libmarias3 2019-06-24 12:14:31 +03:00
Alexander Barkov
5e474f92b5 MDEV-19836 Reuse new I_S table definition helper classes for RocksDB 2019-06-24 06:25:16 +04:00
Eugene Kosov
ddeeb42e0b Merge 10.1 into 10.2 2019-06-23 20:33:13 +03:00
Eugene Kosov
a82e42fd13 NFC: refactor Field::is_equal() and related stuff
Make Field::is_equal() const and return bool as it's a naturally fitting
type for it. Also it's agrument was narrowed to Column_definition.

InnoDB can change type of some columns by itself. InnoDB-specific code used to
reside in Field_xxx:is_equal() methods. Now engine-specific stuff was
moved to a virtual methods of handler::can_convert{string,varstring,blob,geom}.
These methods are called by Field::can_be_converted_by_engine() which is a
double dispatch pattern.

Some InnoDB-specific code still resides in compare_keys_but_name(). It should
be moved from here someday to handler::compare_key_parts(...) or similar.

IS_EQUAL_WITH_REINTERPRET_COMPATIBLE_CHARSET
IS_EQUAL_WITH_REINTERPRET_COMPATIBLE_CHARSET_BUT_COLLATE: both was removed

IS_EQUAL_NO, IS_EQUAL_YES are not needed now and should be removed
along with deprecated handler::check_if_incompatible_data().

HA_EXTENDED_TYPES_CONVERSION: was removed as such logic is not needed now by
server code.

ALTER_COLUMN_EQUAL_PACK_LENGTH: was renamed to a more generic
ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE
2019-06-22 14:09:12 +03:00
Eugene Kosov
854c219a7f MDEV-17301 Change of COLLATE unnecessarily requires ALGORITHM=COPY
Patch is about two cases:
1) On some collate changes it's possible to rebuild only secondary indexes
2) For non-indexed columns collate can be changed INSTANTly

Implemented mostly in Field_{string,varstring,blob}::is_equal().
Make this method return how exactly collationa differs.
This information is later used by fill_alter_inplace_info() to pass
correct info to engine.
2019-06-22 14:09:12 +03:00
Alexander Barkov
8d0983330f MDEV-19833 Reuse new I_S table definition helper classes for Mronga 2019-06-22 06:03:33 +04:00
Alexander Barkov
1cbbe35450 MDEV-19832 Reuse new I_S table definition helper classes for Spider 2019-06-22 05:45:48 +04:00
Sergei Petrunia
821b866b55 Merge branch 'bb-10.2-myrocks-merge' into 10.2 2019-06-21 12:56:26 +03:00
Alexander Barkov
1c27a050e5 MDEV-19818 Reuse new I_S table definition helper classes for TokuDB 2019-06-21 06:48:04 +04:00
Sergei Petrunia
7345c0de26 Fix tests: some build hosts have ramdisk in /run/shm instead of /dev/shm 2019-06-20 21:34:15 +03:00
Sergei Petrunia
622ecfc7c6 Update test results 2019-06-20 19:35:36 +03:00
Sergei Petrunia
a2e9e3fbd4 MyRocks: dont show read-Free replication variables
MariaDB doesn't support Read-Free replication, so showing them only causes
confusion.
Removed variables:
- @@rocksdb_read_free_rpl
- @@rocksdb_read_free_rpl_tables
2019-06-20 15:29:17 +03:00
Eugene Kosov
cf40393471 Merge 5.5 into 10.1 2019-06-20 12:26:01 +03:00
Alexander Barkov
9561b0b47e MDEV-19810 Reuse new I_S table definition helper classes for InnoDB 2019-06-20 11:40:33 +04:00
Marko Mäkelä
49e5323dbd Merge 10.4 into 10.5 2019-06-20 09:22:10 +03:00
Marko Mäkelä
02979daab4 Merge 10.3 into 10.4 2019-06-19 10:49:00 +03:00
Marko Mäkelä
192aa295b4 Merge 10.2 into 10.3 2019-06-19 08:56:10 +03:00
Michael Widenius
8acbf9c1f9 MDEV-19595 fixed
The test cases for the MDEV found several independent bugs
in MariaDB server and Aria:
- If a temporary table was marked as crashed, it could never
  be deleted.
- Opening of a crashed temporary table gave an error message
  but the error was never forwarded to the caller which caused
  an assert() in my_ok()
- init_read_record() did mmap of all temporary tables, which is
  probably not a good idea as this area can potentially be
  very big. Changed code to only mmap internal temporary tables.
- mmap-ed tables where not unmapped in case of repair/optimize
  which caused bad data in table and crashes if the original
  table files where replaced with new ones (as the old mmap
  was still in place). Fixed by removing the mmap in case
  of repair.
- Cleaned up usage of code that disabled mmap in Aria
2019-06-19 00:35:44 +03:00
Michael Widenius
b23c82fef3 MDEV-18078 Assertion `trnman_has_locked_tables(trn) > 0' failed
Problem was that in case of implicit rollback for alter table
Aria did try to run commit twice.

The test case for this is tricky to do in 10.2, so it will
be added to 10.4 as part of BACKUP STAGE testing.
2019-06-18 14:32:24 +03:00
Marko Mäkelä
3c88ce4cd1 Merge 10.4 into 10.5 2019-06-18 11:30:06 +03:00
Michael Widenius
c8b5fa4afc MDEV-19055 Failures with temporary tables and Aria
There was two separate problems:
- Aria pagecache didn't properly handle re-reading of blocks
  that have given errors before (this triggered an assert)
- temporary tables that where opened several times where
  not properly closed in ALTER, REPAIR or OPTIMIZE table

Other things
- Added a couple of asserts that will make it easier to
  find problems like this in the future.
2019-06-17 17:50:08 +03:00
Sergei Golubchik
da619f010f compilation fix for fulltest-big 2019-06-17 12:26:26 +02:00
Nikita Malyavin
a626abb669 Fix LEX_CSTRING passed as argument of printf-like functions 2019-06-17 19:31:17 +10:00
Sergei Petrunia
7f845c6653 Fix typo 2019-06-16 23:21:12 +03:00
Sergei Petrunia
a0251c7d75 Post-merge build fixes
- Don't add DZSTD_STATIC_LINKING_ONLY
- Don't use upstream's way of linking with Jemalloc (MyRocks/MariaDB has
  its own in build_rocksdb.cmake)
- Don't depend on libunwind
2019-06-16 21:44:02 +03:00
Sergei Petrunia
15087b41a5 More Post-merge fixes 2019-06-16 21:07:23 +03:00
Sergei Petrunia
27e05d92be Post-merge fixes cont'd 2019-06-16 20:41:53 +03:00
Sergei Petrunia
6152ecea21 Post-merge fixes: fix rocksdb.tbl_opt_data_index_dir
MariaDB generates both errors and warnings. Warnings are not normally
visible when errors are also produced.
2019-06-16 20:28:01 +03:00
Sergei Petrunia
c399405885 Post-merge fixes: rocksdb.bloomfilter3, use_direct_io_for_flush_and_compaction 2019-06-16 17:42:45 +03:00
Marko Mäkelä
2b660fb4c2 mtr_t::is_block_dirtied(): Define inline 2019-06-16 15:55:09 +03:00
Marko Mäkelä
a94638f155 Clarify the purpose of MTR_LOG_NONE 2019-06-16 15:54:14 +03:00
Marko Mäkelä
e9795d0208 Add mtr_buf_t::for_each_block_in_reverse() const
Avoid unnecessary creation of named objects for invoking
mtr_buf_t::for_each_block_in_reverse().
2019-06-16 15:53:06 +03:00
Sergei Petrunia
23b967d639 Post-merge fixes: fix linking on Windows 2019-06-16 15:29:04 +03:00
Michael Widenius
fb5ee3ff96 Fixed that ma_test_all.sh works
Updated ma_test1 to reflect the change from MDEV-15458 where
ma_write() doesn't update current record position anymore.
2019-06-16 13:31:42 +03:00
Sergei Petrunia
ba2f20cc33 Post-merge fix: fix compilation on Windows 2019-06-16 12:53:13 +03:00
Sergei Petrunia
9c75b3d283 Post-merge fixes 2019-06-16 12:44:04 +03:00
Sergei Petrunia
93c84cc8f2 MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. 2019-06-16 12:13:52 +03:00
Sergei Petrunia
e9e5e7fc92 Post-merge fix: MariaDB doesn't have I_S.PROCESSLIST.SRV_ID 2019-06-16 00:36:04 +03:00
Sergei Petrunia
9ab0d7b4e9 Merge from MyRocks upstream:
Copy of
    commit dcd9379eb5707bc7514a2ff4d9127790356505cb
    Author: Manuel Ung <mung@fb.com>
    Date:   Fri Jun 14 10:38:17 2019 -0700

        Skip valgrind for rocksdb.force_shutdown

        Summary:
        This test does unclean shutdown, and leaks memory.

        Squash with: D15749084

        Reviewed By: hermanlee

        Differential Revision: D15828957

        fbshipit-source-id: 30541455d74
2019-06-16 00:28:33 +03:00
Sergei Petrunia
5173e396ff Copy of
commit dcd9379eb5707bc7514a2ff4d9127790356505cb
Author: Manuel Ung <mung@fb.com>
Date:   Fri Jun 14 10:38:17 2019 -0700

    Skip valgrind for rocksdb.force_shutdown

    Summary:
    This test does unclean shutdown, and leaks memory.

    Squash with: D15749084

    Reviewed By: hermanlee

    Differential Revision: D15828957

    fbshipit-source-id: 30541455d74
2019-06-15 21:29:46 +03:00
Sergei Petrunia
91be2212c6 MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. 2019-06-15 19:55:57 +03:00
Vladislav Vaintroub
bf90a486c3 Do not use LEX_CSTRING in printf-like function 2019-06-14 23:52:13 +02:00
Oleksandr Byelkin
f66d1850ac Merge branch '10.3' into 10.4 2019-06-14 22:10:50 +02:00
Oleksandr Byelkin
4a3d51c76c Merge branch '10.2' into 10.3 2019-06-14 07:36:47 +02:00
Marko Mäkelä
e5fab61a73 MDEV-6275: Use a non-narrowing conversion
On 32-bit systems, sizeof(uint)==sizeof(long).
The C++11 narrowing cast would issue a warning due to the sign mismatch.
2019-06-14 07:53:42 +03:00
Marko Mäkelä
2cd45add27 MDEV-6275: Fix signed/unsigned comparison 2019-06-14 07:34:25 +03:00
Marko Mäkelä
991d5140c3 Merge 10.3 into 10.4 2019-06-14 07:29:20 +03:00
Marko Mäkelä
d9fe615ef6 spider_db_init(): Do not return uninitialized error_num
If the allocation of spider_table_sts_threads failed,
we would DBUG_RETURN(error_num) without having initialized
it earlier.

Pre-initialize error_num to HA_ERR_OUT_OF_MEM and remove
a lot of assignments that thus became redundant.

This error was introduced in 207594afac
(Spider 3.3.13).
2019-06-14 07:26:51 +03:00
Marko Mäkelä
984d7100cd Merge 10.4 into 10.5 2019-06-13 18:36:09 +03:00
Oleksandr Byelkin
50653e021f Merge branch '10.1' into 10.2 2019-06-13 16:42:21 +02:00
Thirunarayanan Balathandayuthapani
e9145aab44 MDEV-19435 buf_fix_count > 0 for corrupted page when it exits the LRU list
Problem:
=========
One of the purge thread access the corrupted page and tries to remove from
LRU list. In the mean time, other purge threads are waiting for same page
in buf_wait_for_read(). Assertion(buf_fix_count == 0) fails for the
purge thread which tries to remove the page from LRU list.

Solution:
========
- Set the page id as FIL_NULL to indicate the page is corrupted before
removing the block from LRU list. Acquire hash lock for the particular
page id and wait for the other threads to release buf_fix_count
for the block.

- Added the error check for btr_cur_open() in row_search_on_row_ref().
2019-06-13 16:13:51 +03:00
Oleksandr Byelkin
5b65d61d93 Merge branch '5.5' into 10.1 2019-06-12 22:54:46 +02:00
Eugene Kosov
039b8782d4 MDEV-13631 Make use of clang-format
Explicitly mention every options in .clang-format to protect us from possible
future changes.

Remove separate InnoDB style.

Change style to look more like this script:
for x in $@
do
 indent -kr -bl -bli0 -l79 -i2 -nut -c48 -dj -cp0 $x
 sed -ri -e 's/ = /= /g'\
         -e '/switch.*\)$/{N;s/\n[ ]+/ /}' $x
done

Significant different is that 'switch' and '{' are put on different lines
because it's impossible in clang-format to set formatting rules just for
'switch' statement.
2019-06-12 22:36:43 +03:00
Marko Mäkelä
d46db415ce MDEV-19738: Skip doublewrite on MLOG_ZIP_PAGE_COMPRESS
page_zip_compress(), page_zip_compress_write_log(),
page_zip_copy_recs(): Replace the parameters page,page_zip with block,
and set buf_page_t::init_on_flush on success
if innodb_log_optimize_ddl=OFF.

page_zip_parse_compress_no_data(): Merge with the only caller
recv_parse_or_apply_log_rec_body().
2019-06-12 20:29:30 +03:00
Marko Mäkelä
8bb4ea2e6f MDEV-19738: Doublewrite buffer is unnecessarily used for newly (re)initialized pages
Thanks to MDEV-12699, the doublewrite buffer will only be needed in
those cases when a page is being updated in the data file. If the page
had never been written to the data file since it was initialized,
then recovery will be able to reconstruct the page based solely on
the contents of the redo log files.

The doublewrite buffer is only really needed when recovery needs to read
the page in order to apply redo log.

Note: As noted in MDEV-19739, we cannot safely disable the doublewrite
buffer if any MLOG_INDEX_LOAD records were written in the past or will
be written in the future. These records denote that redo logging was
disabled for some pages in a tablespace. Ideally, we would have
the setting innodb_log_optimize_ddl=OFF by default, and would not allow
it to be set while the server is running. If we wanted to make this
safe, assignments with SET GLOBAL innodb_log_optimize_ddl=...
should not only issue a redo log checkpoint (including a write of all
dirty pages from the entire buffer pool), but it should also wait for
all pending ALTER TABLE activity to complete. We elect not to do this.

Avoiding unnecessary use of the doublewrite buffer should improve the
write performance of InnoDB.

buf_page_t::init_on_flush: A new flag to indicate whether it is safe to
skip doublewrite buffering when writing the page.

fsp_init_file_page(): When writing a MLOG_INIT_FILE_PAGE2 record,
set the init_on_flush flag if innodb_log_optimize_ddl=OFF.
This is the only function that writes that log record.

buf_flush_write_block_low(): Skip doublewrite if init_on_flush is set.

fil_aio_wait(): Clear init_on_flush.
2019-06-12 20:18:01 +03:00
Marko Mäkelä
38018f48b6 MDEV-19586: Remove unnecessary iteration
recv_apply_hashed_log_recs(): Refer directly to recs.last->end_lsn
instead of iterating the entire list starting from recs.log.
2019-06-12 19:36:30 +03:00
Marko Mäkelä
94e665596d MDEV-19740: Remove some broken InnoDB systemd code
GCC 9.1.1 noticed that sd_notifyf() was always being invoked with
str=NULL argument for "%s". This code was added in
commit 2e814d4702
but not mentioned in the commit comment.

The STATUS messages for systemd matter during startup and shutdown,
and should not be emitted during normal operation.

ib_senderrf(): Remove the potentially harmful sd_notifyf() calls.
2019-06-12 16:25:55 +03:00
Kentoku SHIBA
8e3a4be45c
MDEV-6275 spider_same_server_link not enforced (#1330) 2019-06-12 19:30:50 +09:00
Marko Mäkelä
4bbd8be482 Merge 10.1 into 10.2 2019-06-12 10:30:01 +03:00
Thirunarayanan Balathandayuthapani
b2f76bac03 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- Post-push fix to change the copyright of both xtradb and innodb file.
2019-06-12 12:25:00 +05:30
Thirunarayanan Balathandayuthapani
c5fe1b8fc1 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- If InnoDB encounters garbage or incomplete written log block during
recovery then don't throw the error. Treat it as end of the log.
- This kind of incomplete or empty block can be result of killing
InnoDB when writing the redo log.
2019-06-12 12:17:13 +05:30
Marko Mäkelä
2fd82471ab Merge 10.3 into 10.4 2019-06-12 08:37:27 +03:00
Sergei Golubchik
27fcdb161c MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)
followup for be5c432a42

ha_partition::calculate_checksum() has to invoke calculate_checksum()
for partitions unconditionally, not under (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM).
Because the server uses ::info() to ask for a live checksum, while
calculate_checksum() must, precisely, calculate it the slow way,
also for tables that don't have the live checksum at all.

Also, fix the compilation on Windows (ha_checksum/ulonglong type mix).
2019-06-11 18:42:45 +02:00
Marko Mäkelä
b42dbdbccd Merge 10.2 into 10.3 2019-06-11 13:00:18 +03:00
Marko Mäkelä
177a571e01 MDEV-19586 Replace recv_sys_t::addr_hash with a std::map
InnoDB crash recovery buffers redo log records in a hash table.
The function recv_read_in_area() would pick a random hash bucket
and then try to submit read requests for a few nearby pages.
Let us replace the recv_sys.addr_hash with a std::map, which will
automatically be iterated in sorted order.

recv_sys_t::pages: Replaces recv_sys_t::addr_hash, recv_sys_t::n_addrs.

recv_sys_t::recs: Replaces most of recv_addr_t.

recv_t: Encapsulate a raw singly-linked list of records. This reduces
overhead compared to std::forward_list. Storage and cache overhead,
because the next-element pointer also points to the data payload.
Processing overhead, because recv_sys_t::recs_t::last will point to
the last record, so that recv_sys_t::add() can append straight to the
end of the list.

RECV_PROCESSED, RECV_DISCARDED: Remove. When a page is fully processed,
it will be deleted from recv_sys.pages.

recv_sys_t::trim(): Replaces recv_addr_trim().

recv_sys_t::add(): Use page_id_t for identifying pages.

recv_fold(), recv_hash(), recv_get_fil_addr_struct(): Remove.

recv_read_in_area(): Simplify the iteration.
2019-06-11 11:08:39 +03:00
Marko Mäkelä
992d2494e7 Define page_id_t in buf0types.h 2019-06-11 11:08:39 +03:00
Kentoku SHIBA
be5c432a42
MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)
add checksum_null for setting null value of checksum
2019-06-11 00:25:08 +09:00
Marko Mäkelä
cbac8f9351 MDEV-19725 Incorrect error handling in ALTER TABLE
Some I/O functions and macros that are declared in os0file.h used to
return a Boolean status code (nonzero on success). In MySQL 5.7, they
were changed to return dberr_t instead. Alas, in MariaDB Server 10.2,
some uses of functions were not adjusted to the changed return value.

Until MDEV-19231, the valid values of dberr_t were always nonzero.
This means that some code that was incorrectly checking for a zero
return value from the functions would never detect a failure.

After MDEV-19231, some tests for ALTER ONLINE TABLE would fail with
cmake -DPLUGIN_PERFSCHEMA=NO. It turned out that the wrappers
pfs_os_file_read_no_error_handling_int_fd_func() and
pfs_os_file_write_int_fd_func() were wrongly returning
bool instead of dberr_t. Also the callers of these functions were
wrongly expecting bool (nonzero on success) instead of dberr_t.

This mistake had been made when the addition of these functions was
merged from MySQL 5.6.36 and 5.7.18 into MariaDB Server 10.2.7.

This fix also reverts commit 40becbc3c7
which attempted to work around the problem.
2019-06-10 18:15:25 +03:00
Alexander Barkov
b685109596 MDEV-19710 Split the server side code in rpl_utility.cc into virtual methods in Type_handler 2019-06-07 12:47:24 +04:00
Robert Bindar
bf70430ead MDEV-17709 Remove handlerton::state 2019-06-06 22:09:31 +04:00
Thirunarayanan Balathandayuthapani
bb5d04c9b8 MDEV-19695 Import tablespace doesn't work with ROW_FORMAT=COMPRESSED encrypted tablespace
Problem:
=======
fil_iterate() writes imported tablespace page0 as it is to discarded
tablespace. Space id wasn't even changed. While opening the tablespace,
tablespace fails with space id mismatch error.

Fix:
====
fil_iterate() copies the page0 with discarded space id to imported
tablespace.
2019-06-06 12:54:34 +05:30
Thirunarayanan Balathandayuthapani
b4287ec386 MDEV-19541 InnoDB crashes when trying to recover a corrupted page
- Use corrupt page id instead of whole block after releasing it from
LRU list.
2019-06-05 16:36:51 +05:30