Commit graph

70834 commits

Author SHA1 Message Date
Varun Gupta
9cb55143ac Minor cleanup in the optimizer trace code.
More test coverage added for the optimizer trace.
2019-02-18 17:11:20 +05:30
Daniele Sciascia
7d2138d4a4 MTR tests for galera sync wait up to 2019-02-18 12:54:42 +02:00
Sergei Petrunia
3f154943db MDEV-18608: Defaults for 10.4: histogram size should be set
Followup: update test results
2019-02-18 13:37:57 +03:00
Sergei Petrunia
15a77a1a2c MDEV-18608: Defaults for 10.4: histogram size should be set
Change the defaults:

-histogram_size=0
+histogram_size=254

-histogram_type=SINGLE_PREC_HB
+histogram_type=DOUBLE_PREC_HB

Adjust the testcases:
- Some have ignorable changes in EXPLAIN outputs and
  more counter increments due to EITS table reads.
- Testcases that meaningfully depend on the old defaults
  are changed to use the old values.
2019-02-18 13:37:57 +03:00
Marko Mäkelä
a12d0d5a56 MDEV-18609 Assertion !is_string || (*af)->charset() == cf->charset failed
The Create_field::charset can contain garbage for columns
that the SQL layer does not consider as being string columns.
InnoDB considers BIT a string column for historical reasons
(and backward compatibility with old persistent InnoDB metadata),
and therefore it checked the charset.

The Field::charset() consistently is my_charset_bin for BIT,
so we can trust that one.
2019-02-18 11:44:20 +02:00
Daniele Sciascia
9b8fc089bd MDEV-18198 Fix MTR test galera_sr.galera_sr_table_contents
* Created new binlog-header file
* Fixed warning on SELECT INTO DUMPFILE
* Re-recorded the test result
2019-02-18 08:25:57 +02:00
Marko Mäkelä
790b6f5ae2 MDEV-18598: Wrong results after instant integer conversions
Field_str::is_equal(): Do not allow instant conversions between
BIT (which is stored big-endian) and integer types (which can
be stored big-endian or little-endian, depending on storage engine).

row_sel_field_store_in_mysql_format_func(): Properly extend
narrower integer and DATA_FIXBINARY values to the current format.
DATA_FIXBINARY was incorrectly padded with 0x20 instead of 0.
2019-02-17 01:05:31 +02:00
Marko Mäkelä
e9e47889c8 Merge 10.3 into 10.4 2019-02-16 12:34:41 +02:00
Marko Mäkelä
df51dc28f5 Fix tests for innodb_checksum_algorithm=strict_crc32
In tests that directly write InnoDB data file pages,
compute the innodb_checksum_algorithm=crc32 checksums,
instead of writing the 0xdeadbeef value used by
innodb_checksum_algorithm=none. In this way, these tests
will not cause failures when executing
./mtr --mysqld=--loose-innodb-checksum-algorithm=strict_crc32
2019-02-16 12:06:52 +02:00
Igor Babaev
a44f2c3ee8 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-15 07:48:18 -08:00
Marko Mäkelä
e1af460146 MDEV-18579 Assertion !ctx->online || num_fts_index == 0
instant_alter_column_possible(): Add the other MDEV-17459 work-around
condition. The existence of fulltext indexes only prevents instant
DROP COLUMN or changing the order of columns. Other forms of instant
ALTER TABLE are no problem.

Before commit 4e7ee166a9 that merged
the MDEV-18295 fix from 10.3, the work-around of MDEV-17459 in
instant_alter_column_possible() was categorically refusing any
ALGORITHM=INSTANT if any FULLTEXT INDEX was present. After that commit,
a related condition was only present in prepare_inplace_alter_table_dict()
but not in the other callers of instant_alter_column_possible().
2019-02-15 13:56:04 +02:00
Marko Mäkelä
2b921845ac Merge 10.3 into 10.4 2019-02-15 12:30:43 +02:00
Jan Lindström
dcaabf07fd MDEV-18109: Galera 4: run galera_sr test suite
Fix some of the galera_sr suite test failures.
Remove tests that are not going to be run because required
feature is not supported.

	modified:   mysql-test/suite/galera_sr/disabled.def
	deleted:    mysql-test/suite/galera_sr/r/GCF-574.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_load_data.result
	deleted:    mysql-test/suite/galera_sr/r/galera_sr_sbr.result
	modified:   mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result
	deleted:    mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result
	deleted:    mysql-test/suite/galera_sr/t/GCF-574.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf
	modified:   mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_load_data.test
	deleted:    mysql-test/suite/galera_sr/t/galera_sr_sbr.test
	modified:   mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test
	deleted:    mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test
2019-02-15 09:33:49 +02:00
Igor Babaev
98d55b1366 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-14 22:07:33 -08:00
Igor Babaev
ccce4d3be9 MDEV-16188 Post review fixes
Also adjusted some test files.
2019-02-14 15:23:23 -08:00
Marko Mäkelä
ea0be9e2d6 MDEV-15564 Avoid table rebuild in ALTER TABLE on collation or charset changes
Allow ALGORITHM=INSTANT (or avoid touching any data)
when changing the collation, or in some cases, the character set,
of a non-indexed CHAR or VARCHAR column. There is no penalty
for subsequent DDL or DML operations, and compatibility with
older MariaDB versions will be unaffected.

Character sets may be changed when the old encoding is compatible
with the new one. For example, changing from ASCII to anything
ASCII-based, or from 3-byte to 4-byte UTF-8 can sometimes be
performed instantly.

This is joint work with Eugene Kosov.
The test cases as well as ALTER_CONVERT_TO, charsets_are_compatible(),
Type_handler::Charsets_are_compatible() are his work.
The Field_str::is_equal(), Field_varstring::is_equal() and
the InnoDB changes were mostly rewritten by me due to conflicts
with MDEV-15563.

Limitations:

Changes of indexed columns will still require
ALGORITHM=COPY. We should allow ALGORITHM=NOCOPY and allow
the indexes to be rebuilt inside the storage engine,
without copying the entire table.

Instant column size changes (in bytes) are not supported by
all storage engines.

Instant CHAR column changes are only allowed for InnoDB
ROW_FORMAT=REDUNDANT. We could allow this for InnoDB
when the CHAR internally uses a variable-length encoding,
say, when converting from 3-byte UTF-8 to 4-byte UTF-8.

Instant VARCHAR column changes are allowed for InnoDB
ROW_FORMAT=REDUNDANT, and for others only if the size
in bytes does not change from 128..255 bytes to more
than 256 bytes.

Inside InnoDB, this slightly changes the way how MDEV-15563
works and fixes the result of the innodb.instant_alter_extend test.
We change the way how ALTER_COLUMN_EQUAL_PACK_LENGTH_EXT
is handled. All column extension, type changes and renaming
now go through a common route, except when ctx->is_instant()
is in effect, for example, instant ADD or DROP COLUMN has
been initiated. Only in that case we will go through
innobase_instant_try() and rewrite all column metadata.

get_type(field, prtype, mtype, len): Convert a SQL data type into
InnoDB column metadata.

innobase_rename_column_try(): Remove the update of SYS_COLUMNS.

innobase_rename_or_enlarge_column_try(): New function,
replacing part of innobase_rename_column_try() and all of
innobase_enlarge_column_try(). Also changes column types.

innobase_rename_or_enlarge_columns_cache(): Also change
the column type.
2019-02-14 20:17:14 +02:00
Robert Bindar
6c8ce999f8 MDEV-13095 Implement User Account locking
Add server support for user account locking.
This patch extends the ALTER/CREATE USER statements for
denying a user's subsequent login attempts:
  ALTER USER
    user [, user2] ACCOUNT [LOCK | UNLOCK]
  CREATE USER
    user [, user2] ACCOUNT [LOCK | UNLOCK]
The SHOW CREATE USER statement was updated to display the
locking state of an user.

Closes #1006
2019-02-14 17:30:22 +01:00
Sergei Golubchik
d89cdfc229 bugfix: mysql_fix_privilege_tables table_schema=database()
fix mysql_fix_privilege_tables to look for the `user` table in the
correct schema when deciding whether to convert it to `global_priv` table

make related tests a bit more verbose
2019-02-14 17:30:22 +01:00
Sergei Golubchik
c0745e3730 bugfix: CREATE...SELECT lost COMMENT and VERSIONING 2019-02-14 17:30:22 +01:00
Jan Lindström
677a1e7c52
Merge pull request #1183 from codership/10.4-wsrep_debug
WSREP debug log levels support
2019-02-14 14:29:01 +02:00
Igor Babaev
e1de23b8d5 MDEV-16188 Introduced the notion of adjusted filter gain.
Due to inconsistent usage of different cost models to calculate
the cost of ref accesses we have to make the calculation of the
gain promising by usage a range filter more complex.
2019-02-14 00:17:20 -08:00
Igor Babaev
7d9f45e072 Merge branch '10.4' into bb-10.4-mdev17096 2019-02-13 14:59:34 -08:00
mkaruza
3e64e7f24c WSREP debug log levels support
Global variable wsrep_debug now can be used to filter wsrep-lib messages based on debug level provided.
Type of wsrep_debug is now set to be unsigned int, so tests and configuration files changed accordingly.
2019-02-13 18:47:27 +01:00
Monty
0f48949439 MDEV-13916 Enforce check constraint on JSON type
When creating a field of type JSON, it will be automatically
converted to TEXT with CHECK (json_valid(`a`)), if there wasn't any
previous check for the column.

Additional things:
- Added two bug fixes that was found while testing JSON. These bug
  fixes has also been pushed to 10.3 (with a test case), but as they
  where minimal and needed to get this task done and tested, the fixes
  are repeated here.
  - CREATE TABLE ... SELECT drops constraints for columns that
    are both in the create and select part.
  - If one has both a default expression and check constraint for a
    column, one can get the error "Expression for field `a` is refering
    to uninitialized field `a`.
- Removed some duplicate MYSQL_PLUGIN_IMPORT symbols
2019-02-13 19:40:26 +02:00
Monty
438811b4b2 Fixed two bugs related to column level constraints
- CREATE TABLE ... SELECT drops constraints for columns that
  are both in the create and select part.
  - Fixed by copying the constraint in
    Column_definiton::redefine_stage1_common()
- If one has both a default expression and check constraint for a
  column, one can get the error "Expression for field `a` is refering
  to uninitialized field `a`.
  - Fixed by ignoring default expressions for current column when checking
    for CHECK constraint
2019-02-13 18:21:19 +02:00
Marko Mäkelä
22feb179ae MDEV-15563: Instant ROW_FORMAT=REDUNDANT column extension
This was developed by Aleksey Midenkov based on my design.

In the original InnoDB storage format (that was retroactively named
ROW_FORMAT=REDUNDANT in MySQL 5.0.3), the length of each index field
is stored explicitly.

Because of this, we can and now will allow instant conversion from
VARCHAR to CHAR or VARBINARY to BINARY of equal or greater size,
as well as instant conversion of TINYINT to SMALLINT to MEDIUMINT
to INT to BIGINT (while not changing between signed and unsigned).

Theoretically, we could allow changing from an unsigned integer to
a bigger unsigned integer, as well as changing CHAR to VARCHAR, but
that would require additional metadata and conversions whenever
reading old records.

Field_str::is_equal(), Field_varstring::is_equal(), Field_num::is_equal():
Return the new result IS_EQUAL_PACK_LENGTH_EXT if the table advertises
HA_EXTENDED_TYPES_CONVERSION capability and we are considering the
above-mentioned conversions.

ALTER_COLUMN_EQUAL_PACK_LENGTH_EXT: A new ALTER TABLE flag, similar
to ALTER_COLUMN_EQUAL_PACK_LENGTH but requiring conversions when
reading the data. The Field::is_equal() result IS_EQUAL_PACK_LENGTH_EXT
will map to this flag.

dtype_get_fixed_size_low(): For BINARY, CHAR and integer columns
in ROW_FORMAT=REDUNDANT, return 0 (variable length) from now on.

dtype_get_sql_null_size(): Keep returning the current size for
BINARY, CHAR and integer columns, so that in ROW_FORMAT=REDUNDANT
it will remain possible to update in place between NULL and NOT NULL
values.

btr_index_rec_validate(): Relax a CHECK TABLE length check for
ROW_FORMAT=REDUNDANT tables.

btr_cur_instant_init_low(): No longer trust fixed_len
for ROW_FORMAT=REDUNDANT tables.

We cannot rely on fixed_len anymore because the record can have shorter
length from before instant extension. Note that importing such tablespace
into earlier MariaDB versions produces ER_TABLE_SCHEMA_MISMATCH when
using a .cfg file.
2019-02-13 17:39:05 +02:00
Marko Mäkelä
0ae3ea7919 MDEV-15563: Instant VARCHAR extension for ROW_FORMAT=REDUNDANT
In the original InnoDB storage format (which was retroactively named
ROW_FORMAT=REDUNDANT in MySQL 5.0.3), the length of each index field
is stored explicitly. Thus, we can and from now on will allow arbitrary
extension of VARBINARY and VARCHAR columns when the table is in
ROW_FORMAT=REDUNDANT.

ha_innobase::open(): Advertise a new HA_EXTENDED_TYPES_CONVERSION
capability for ROW_FORMAT=REDUNDANT tables.

Field_varstring::is_equal(): If the HA_EXTENDED_TYPES_CONVERSION
capability is advertised for the table, return IS_EQUAL_PACK_LENGTH
for any length extension.
2019-02-13 16:42:03 +02:00
Marko Mäkelä
ad17875c0d MDEV-15563: Allow instant VARCHAR extension from <128 bytes
For up to 127 bytes length, InnoDB would use 1 byte for length, and
that byte would always be less than 128. If the maximum length is
longer than 255 bytes, InnoDB would use a variable-length encoding
for the length, using 1 byte for lengths up to 127 bytes, and
2 bytes for longer lengths.

Thus, 1-byte lengths are always compatible when the maximum size
changes from less than 128 bytes to anything longer.

Field_varstring::is_equal(): Return IS_EQUAL_PACK_LENGTH also when
converting from VARCHAR less than 128 bytes to any longer VARCHAR.
2019-02-13 15:46:52 +02:00
Marko Mäkelä
8ef4105a89 MDEV-6111: Adjust a result 2019-02-13 15:46:04 +02:00
Jan Lindström
c2c637c583
Merge pull request #1180 from codership/10.4-load-data-splitting
10.4 make wsrep_load_data_splitting use streaming replication
2019-02-13 13:29:51 +02:00
Jan Lindström
6476126cba MDEV-18564: Change wsrep_load_data_splitting off by default
Variable wsrep_load_data_splitting is deprecated and should be off
by default.
2019-02-13 13:19:37 +02:00
Igor Babaev
953ca199fb Merge branch '10.4' into bb-10.4-mdev17096 2019-02-12 23:19:43 -08:00
Varun Gupta
be8709eb7b MDEV-6111 Optimizer Trace
This task involves the implementation for the optimizer trace.

This feature produces a trace for any SELECT/UPDATE/DELETE/,
which contains information about decisions taken by the optimizer during
the optimization phase (choice of table access method, various costs,
transformations, etc). This feature would help to tell why some decisions were
taken by the optimizer and why some were rejected.

Trace is session-local, controlled by the @@optimizer_trace variable.
To enable optimizer trace we need to write:
   set @@optimizer_trace variable= 'enabled=on';

To display the trace one can run:
   SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;

This task also involves:
    MDEV-18489: Limit the memory used by the optimizer trace
    introduces a switch optimizer_trace_max_mem_size which limits
    the memory used by the optimizer trace. This was implemented by
    Sergei Petrunia.
2019-02-13 11:52:36 +05:30
Igor Babaev
17d00d9a94 MDEV-17096 Pushdown of simple derived tables to storage engines
Made the setting of the system variable federated_pushdown at
the default connection.
2019-02-12 14:00:48 -08:00
Igor Babaev
58b950737c MDEV-17096 Pushdown of simple derived tables to storage engines
Added plugin system variable federated_pushdown.
2019-02-12 13:11:32 -08:00
Sergei Golubchik
b9f3f06857 MDEV-12484 Enable unix socket authentication by default
Change the default authentication for root@localhost to

  IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket

which provides secure passwordless login, while still allowing
SET PASSWORD to work as expected.

Also create a second all-privilege account for the user that owns
datadir (and thus has full access to the data anyway).

Compile unix_socket plugin statically into the server.
2019-02-12 19:14:37 +01:00
Teemu Ollakka
f20dfeecc6 Recorded galera_sr_load_data_splitting, galera_sr_load_data 2019-02-12 10:37:05 +02:00
Alexander Barkov
ce6505f890 MDEV-18447 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv 2019-02-12 11:59:17 +04:00
Marko Mäkelä
9f56dd7382 Merge 10.3 into 10.4 2019-02-11 17:55:25 +02:00
Jan Lindström
3a269a8b52 Record galera_var_load_data_splitting result after deprecating
warning.
2019-02-11 14:59:59 +02:00
Marko Mäkelä
4e7ee166a9 MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
When importing a tablespace, we must initialize dummy DEFAULT NULL
values for any instantly added columns in order to avoid a debug
assertion failure when PageConverter::update_records() invokes
rec_get_offsets(). Finally, when the operation completes, we must
evict and reload the table definition, so that the correct
default values for instantly added columns will be loaded.

ha_innobase::discard_or_import_tablespace(): On successful
IMPORT TABLESPACE, evict and reload the table definition,
so that btr_cur_instant_init() will load the correct metadata.

PageConverter::update_index_page(): Fill in dummy DEFAULT NULL values
for instantly added columns. These will be replaced upon the
completion of the operation by evicting and reloading the metadata.

row_discard_tablespace(): Invoke dict_table_t::remove_instant().
After DISCARD TABLESPACE, the table is no longer in "instant ALTER"
format, because there is no data file attached.
2019-02-11 14:42:48 +02:00
Jan Lindström
cbfbb70dd2
Merge pull request #1170 from codership/10.4-rsync_fix
MDEV-18178, mariabackup script timestamp change, galera suite fixed & re-recorded tests
2019-02-11 13:46:26 +02:00
Marko Mäkelä
76c34a74a8 Fix the 32-bit results for max_rowid_filter_size 2019-02-11 09:24:31 +02:00
Igor Babaev
cd00d03fe2 MDEV-16188 Fixed the code of ha_partition::multi_range_read_info()
The code was rewritten in the same way as the code of
ha_partition::multi_range_read_info_const() had been rewritten
earlier.

The fix allowed to run spider.partition_mrr.
2019-02-10 21:15:48 -08:00
Galina Shalygina
3955d2a153 MDEV-18413: Find constraint correlated indexes
Find indexes of one table which parts participate in one constraint.
These indexes are called constraint correlated.

New methods: TABLE::find_constraint_correlated_indexes() and
virtual method check_index_dependence() were added.
For each index it's own constraint correlated index map was created
where all indexes that are constraint correlated with the current are
marked.

The results of this task are used for MDEV-16188 (Use in-memory
PK filters built from range index scans).
2019-02-10 22:36:46 +03:00
Igor Babaev
d11be23933 MDEV-17096 Pushdown of simple derived tables to storage engines
Resolved the problem of forming a proper query string for FEDERATEDX.
Added test cases.

Cleanup of extra spaces.
2019-02-09 22:54:26 -08:00
Igor Babaev
15fe81c571 MDEV-16188 Post merge fixes: trying to get rid of Windows warnings. 2019-02-09 10:54:26 -08:00
Igor Babaev
9fe1e83df0 MDEV-16188 Post merge fixes: more for TokuDB 2019-02-08 12:32:31 -08:00
Marko Mäkelä
b8e867e869 MDEV-18219 Assertion index->n_core_null_bytes <= ... after DROP COLUMN
rec_init_offsets(): Relax a debug assertion that is too strict
during the execution of btr_cur_instant_init_low().
2019-02-08 18:46:03 +02:00
mkaruza
131a4680c7 Fixed and re-recorded tests for galera
Re-recorded: galera.galera_gcache_recover_manytrx
Fixed: galera_3nodes.galera_evs_suspect_timeout
2019-02-08 14:26:56 +01:00