Commit graph

66961 commits

Author SHA1 Message Date
Sachin Setiya
e4a2e80a57 MDEV-11229: galera.MW-258 galera.galera_as_master fail in buildbot. 2017-03-03 12:18:14 +05:30
Marko Mäkelä
6cf29ab0df MDEV-12146 Deprecate and remove innodb_instrument_semaphores
MDEV-7618 introduced configuration parameter innodb_instrument_semaphores
in MariaDB Server 10.1. The parameter seems to only affect the rw-lock
X-latch acquisition. Extra fields are added to rw_lock_t to remember one
X-latch holder or waiter. These fields are not being consulted or reported
anywhere. This is basically only adding code bloat.

If the intention is to debug hangs or deadlocks, we have better tools for
that in the debug server, and for the non-debug server, core dumps can
reveal a lot. For example, the mini-transaction memo records the
currently held buffer block or index rw-locks, to be released at
mtr_t::commit().

The configuration parameter innodb_instrument_semaphores will be
deprecated in 10.2.5 and removed in 10.3.0.

rw_lock_t: Remove the members lock_name, file_name, line, thread_id
which did not affect any output.
2017-02-28 12:42:45 +02:00
Marko Mäkelä
78153cf641 MDEV-11927 InnoDB change buffer is not being merged
to tables in the system tablespace

This is a regression caused by MDEV-11585, which accidentally
changed Tablespace::is_undo_tablespace() in an incorrect way,
causing the InnoDB system tablespace to be reported as a dedicated
undo tablespace, for which the change buffer is not applicable.

Tablespace::is_undo_tablespace(): Remove. There were only 2
calls from the function buf_page_io_complete(). Replace those
calls as appropriate.

Also, merge changes to tablespace import/export tests from
MySQL 5.7, and clean up the tests a little further, allowing
them to be run with any innodb_page_size.

Remove duplicated error injection instrumentation for the
import/export tests.  In MySQL 5.7, the error injection label
buf_page_is_corrupt_failure was renamed to
buf_page_import_corrupt_failure.

fil_space_extend_must_retry(): Correct a debug assertion
(tablespaces can be extended during IMPORT), and remove a
TODO comment about compressed temporary tables that was
already addressed in MDEV-11816.

dict_build_tablespace_for_table(): Correct a comment that
no longer holds after MDEV-11816, and assert that
ROW_FORMAT=COMPRESSED can only be used in .ibd files.
2017-02-24 22:16:33 +02:00
Marko Mäkelä
b513e37117 Clean up some Galera tests.
Note: At least one test is unstable, failing with the following:
./mtr --mysqld=--innodb-purge-threads=9 --big-test --no-reorder \
galera.galera_parallel_autoinc_largetrx galera.galera_var_slave_threads

The result difference is dependent on innodb_purge_threads.
2017-02-24 22:13:42 +02:00
Marko Mäkelä
51af19851a MDEV-11454 post-merge fix:
buf_dump(): Correct the printf format passed to buf_dump_status()
to match the argument types.

Revert the changes to storage/xtradb. XtraDB is not being compiled
for 10.2. The unused copy that we have in the 10.2 branch is only
getting merges from 10.1.

Disable the test sys_vars.innodb_buffer_pool_dump_pct_function
because it is unstable on buildbot.
2017-02-24 22:12:01 +02:00
Marko Mäkelä
342b48b7b1 Merge pull request #264 from grooverdan/10.2-MDEV-11454-innodb_buffer_pool_dump_pct-entire-pool
MDEV-11454: Make innodb_buffer_pool_dump_pct refer to the entire buffer pool size
2017-02-24 15:12:09 +02:00
Sergei Golubchik
979e94d264 followup for 96d097a7fa
copy-paste error
2017-02-21 20:31:06 +01:00
Marko Mäkelä
cc4b2b185d MDEV-11802 preparation: Clean up the purge tests.
Revert the MDEV-4396 tweak to innodb.innodb_bug14676111.
We must fix the root cause instead.

Allow gcol.innodb_virtual_purge to run on a non-debug build
(If wait_innodb_all_purged.inc is used in a non-debug test,
it will have no effect.)

Add the test innodb.index_merge_threshold from MySQL 5.7.
2017-02-19 14:51:19 +02:00
Marko Mäkelä
34bbc76f1c Simplify a WL#6494/WL#7142 test.
The test innodb.log_file_size_checkpoint was originally added to
MySQL 5.7 by me in a bug fix, to fix the interaction of WL#6494
(redo log resizing, introduced in MySQL 5.6) and WL#7142
(data file discovery based on MLOG_FILE_NAME records,
introduced in MySQL 5.7):

commit 70f9ef4e1220827132b50275ca7272f2bcca1864
Author: Marko Mäkelä <marko.makela@oracle.com>
Date:   Wed May 21 13:31:29 2014 +0300

    Bug#18755095 REDO LOG SIZE CHANGE AFTER CRASH RESULTS IN CHECKPOINT AGE
    ERROR MESSAGE

    This is a regression from fixing
    Bug#18730524 REPEATED KILL+RESTART FAILS DUE TO MISSING MLOG_FILE_NAME
    RECORD

    innobase_start_or_create_for_mysql(): Invoke fil_names_clear() before
    creating the "checkpoint" when changing redo log files.

    Approved by Jimmy Yang on IM.

The relevant part of the test is that fil_names_clear() is invoked to
emit an MLOG_CHECKPOINT record before the redo log files are deleted.
In case the server is killed before ib_logfile0 has been deleted,
the old (not-yet-resized) redo log will be treated as valid. We do not
need to create a large number of tables for that.
2017-02-16 09:18:46 +02:00
Igor Babaev
37925c6ccc Fixed bug mdev-9924.
Supported queries with window functions when GROUP BY could be
optimized away.
2017-02-15 22:41:45 -08:00
Sergei Petrunia
e688d81444 MDEV-10694 - SIGFPE and/or huge memory allocation in maria_create ...
The issue was that JOIN::rollup_write_data() used
JOIN::tmp_table_param::[start_]recinfo, which had uninitialized data.

These fields have uninitialized data, because JOIN::tmp_table_param
currently only stores some grouping-related data fields.  The data about
the work (temporary) tables themselves is stored in
join->join_tab[...].tmp_table_param.

The fix is to make JOIN::rollup_write_data follow this convention
and look at the right TMP_TABLE_PARAM object
2017-02-15 13:47:41 -08:00
Vicențiu Ciorbaru
eb54d86b58 MDEV-10700: 10.2.2 windowing function returns incorrect result
This bug is fixed by MDEV-10092. Add test case to check for regressions.
2017-02-15 14:09:27 +02:00
Vicențiu Ciorbaru
d06a44e027 MDEV-11868: min ( distinct ) over ( ) returns wrong value
The bug was not visible in current HEAD. Introduced test case to catch
regressions. Also improve error messages regarding distinct usage in
window functions.
2017-02-15 14:09:27 +02:00
Vicențiu Ciorbaru
88ddb1ea4e MDEV-11697: Lead Window Function Returns Incorrect Results
This issue is fixed by the patch for MDEV-10092. Add test case to check
for regressions though.
2017-02-15 14:09:27 +02:00
Vicențiu Ciorbaru
d474642254 MDEV-10092: Server crashes in in ha_heap::rnd_pos / Table_read_cursor::get_next
The bug was caused by several issues.
2 problems in seek_io_cache. Due to wrong offsets used, we would end up
seeking way too much (first change), or over the intended seek point
(second change). Fixing it requires correctly detecting available data
in buffer (first change), and not using "IO_SIZE alligned" reads. The
second is needed because _my_b_cache_read adjusts the pos_in_file itself
based on read_pos and read_end. Pretending buffer is empty when we want
to force a read will aleviate this problem.

Secondly, the big-table cursors didn't repect the interface definitions
of always returning the rownumber that Table_read_cursor::fetch() would activate.

At the same time, next(), prev() and move_to() should not perform any
row activation.
2017-02-15 14:09:27 +02:00
Vicențiu Ciorbaru
9fe9fb68ac MDEV-10859: Wrong result of aggregate window function in query with HAVING and no ORDER BY
Window functions need to be computed after applying the HAVING clause.
An optimization that we have for regular, non-window function, cases is
to apply having only during sending of the rows to the client. This
allows rows that should be filtered from the temporary table used to
store aggregation results to be stored there.

This behaviour is undesireable for window functions, as we have to
compute window functions on the result-set after HAVING is applied.
Storing extra rows in the table leads to wrong values as the frame
bounds might capture those -to be filtered afterwards- rows.
2017-02-15 14:09:27 +02:00
Marko Mäkelä
2af28a363c MDEV-11782: Redefine the innodb_encrypt_log format
Write only one encryption key to the checkpoint page.
Use 4 bytes of nonce. Encrypt more of each redo log block,
only skipping the 4-byte field LOG_BLOCK_HDR_NO which the
initialization vector is derived from.

Issue notes, not warning messages for rewriting the redo log files.

recv_recovery_from_checkpoint_finish(): Do not generate any redo log,
because we must avoid that before rewriting the redo log files, or
otherwise a crash during a redo log rewrite (removing or adding
encryption) may end up making the database unrecoverable.
Instead, do these tasks in innobase_start_or_create_for_mysql().

Issue a firm "Missing MLOG_CHECKPOINT" error message. Remove some
unreachable code and duplicated error messages for log corruption.

LOG_HEADER_FORMAT_ENCRYPTED: A flag for identifying an encrypted redo
log format.

log_group_t::is_encrypted(), log_t::is_encrypted(): Determine
if the redo log is in encrypted format.

recv_find_max_checkpoint(): Interpret LOG_HEADER_FORMAT_ENCRYPTED.

srv_prepare_to_delete_redo_log_files(): Display NOTE messages about
adding or removing encryption. Do not issue warnings for redo log
resizing any more.

innobase_start_or_create_for_mysql(): Rebuild the redo logs also when
the encryption changes.

innodb_log_checksums_func_update(): Always use the CRC-32C checksum
if innodb_encrypt_log. If needed, issue a warning
that innodb_encrypt_log implies innodb_log_checksums.

log_group_write_buf(): Compute the checksum on the encrypted
block contents, so that transmission errors or incomplete blocks can be
detected without decrypting.

Rewrite most of the redo log encryption code. Only remember one
encryption key at a time (but remember up to 5 when upgrading from the
MariaDB 10.1 format.)
2017-02-15 08:07:20 +02:00
Marko Mäkelä
743ac7c2d0 MDEV-12061 Allow innodb_log_files_in_group=1
The InnoDB redo log consists of a list of files that logically form
a bigger file, as if the individual files were concatenated together.

The first file will always be written on redo log checkpoint, because
the two checkpoint pages are at the start of the single logical
redo log file.

There is no technical reason why InnoDB requires at least 2 files
to exist. Let us reduce the minimum number to 1. In that way,
restoring from backups will become easier, since InnoDB can directly
deal with a single backed-up redo log file.
2017-02-15 08:07:20 +02:00
Sergei Golubchik
3d85292afd sporadic failures of rpl.rpl_binlog_errors
the test restarts the server, giving it 60 seconds to shutdown
and then killing it mercilessly.

make sure the server closes all MyISAM tables before shutdown,
as we cannot reliably expect it to make the deadline.
2017-02-14 20:43:41 +01:00
Sergei Golubchik
96d097a7fa sporadic failures of main.default_debug
wait for the first connection to reach the debug sync point
before letting the second connection do its stuff
2017-02-14 20:43:41 +01:00
Sergei Golubchik
41f42dff06 cleanup: mtr startup warning
options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set

1. s/--log_slow_queries/--log-slow-queries/
2. disable log-slow-admin-statement/etc in mytr when doing mysqld --help
2017-02-14 20:43:41 +01:00
Sergei Golubchik
6f6d0531dc MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work
Use JSON_COMPACT(X) instead of CAST(X AS JSON).
Bonus - X is validated to be a valid JSON.
Fix a typo in the error message.
2017-02-14 20:43:41 +01:00
Alexey Botchkov
f76d5fefb8 MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to
work.

        json_detailed() fixed
2017-02-14 17:51:03 +04:00
Marko Mäkelä
2bf07556e8 Post-push fix for MDEV-12057.
Fix a test result for the narrower type of innodb_fast_shutdown.
2017-02-14 10:53:17 +02:00
Vicențiu Ciorbaru
d731ce21a7 MDEV-11170: MariaDB 10.2 cannot start on MySQL 5.7 datadir
PART 2 of the fix adds the logic of not using password column, unless it
exists. If password column is missing we attempt to use plugin &&
authentication_string columns.
2017-02-14 07:46:58 +02:00
Vicențiu Ciorbaru
5bf338435a MDEV-11746: Wrong result upon using FIRST_VALUE with a window frame
The same approach is needed for LAST_VALUE, otherwise the LAST_VALUE sum
functions are not cleared correctly. Now LAST_VALUE behaves as NTH_VALUE
with 0 offset, only that the frame that it is examining is the bottom bound,
not the top bound.
2017-02-14 07:46:58 +02:00
Vicențiu Ciorbaru
57341852b5 MDEV-11746: Wrong result upon using FIRST_VALUE with a window frame
Reimplement FIRST_VALUE to act as NTH_VALUE with 0 offset. The previous
implementation was flawed when the window frame would remove values.
2017-02-14 07:46:58 +02:00
Vicențiu Ciorbaru
f675eab7dc MDEV-10122: MariaDB does not support group functions in some contexts where MySQL does
The problematic queries involve unions. For unions we have an
optimization where we skip the ORDER BY clause in a query from one side
of the union if it will be performed later due to UNION.
EX:
(SELECT a from t1 ORDER BY a) ORDER BY b;
The first ordering by a is not necessary and it gets removed.

The problem is that we still need to resolve the Items before removing the
ORDER BY list from the
SELECT_LEX structure. During this final resolve step however, we forgot to
allow SET functions within the ORDER BY clause. This caused us to return
an "Invalid use of group function" error during the checking performed
by fix_fields in Item_sum::init_sum_func_check.
2017-02-14 07:46:58 +02:00
Sergei Golubchik
e1f0f0dd06 Revert "MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work"
This reverts commit 1f372cf1de.
Wasn't supposed to be pushed just yet.
2017-02-13 18:37:06 +01:00
Sergei Golubchik
1f372cf1de MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to work
remove CAST(... AS JSON) from the grammar for 10.2.4
2017-02-13 18:19:02 +01:00
Sergei Golubchik
87075e7f87 MDEV-11704 InnoDB: Failing assertion: dfield_is_null(dfield2) || dfield2->data
relax innodb assertion, because Field_blob::store() clearly says
that a data pointer can be zero if the length is zero.
2017-02-13 18:12:16 +01:00
Sergei Golubchik
239790d92f MDEV-11604 Assertion `!check_datetime_range(ltime)' failed in TIME_to_longlong_datetime_packed 2017-02-13 18:12:16 +01:00
Sergei Golubchik
1afb11074e MDEV-11582 InnoDB: Failing assertion: !((field)->vcol_info && !(field)->stored_in_db())
change the parser not to allow SERIAL as a normal data type.
make a special rule for it, where it could be used for define
fields, but not generated fields, not return type of a stored function, etc.
2017-02-13 18:12:15 +01:00
Sergei Golubchik
8d99166c69 MDEV-11640 gcol.gcol_select_myisam fails in buildbot on Power
JOIN_CACHE's were initialized in  check_join_cache_usage()
from make_join_readinfo(). After that make_join_readinfo() was looking
whether it's possible to use keyread. Later, after make_join_readinfo(),
optimizer decided whether to use filesort. And even later, at the
execution time, from join_read_first(), keyread was actually enabled.

The problem is, that if a query uses a vcol, base columns that it
depends on are automatically added to the read_set - because they're
needed to calculate the vcol. But if we're doing keyread, vcol is taken
from the index, not calculated, and base columns do not need to  be
in the read set (even should not be - as they aren't getting values).

The bug was that JOIN_CACHE used read_set with base columns,
they were not read because of keyread, so it was caching garbage.

So read_set is only known after the keyread was decided. And after the
filesort was decided, as filesort doesn't use keyread. But
check_join_cache_usage() needs to be done in make_join_readinfo(),
as the code below depends on these checks,

Fix: keep JOIN_CACHE checks where they were, but move initialization
down to the very end of JOIN::optimize_inner. If keyread was enabled,
update the read_set to include only columns that are part of the index.
Copy the keyread logic from join_read_first() to happen at optimize time.
2017-02-13 18:12:14 +01:00
Sergei Golubchik
01dd355635 cleanup: make a couple of tests more robust
with --sorted_result
2017-02-13 18:12:05 +01:00
Sergei Golubchik
5d7607f340 cleanup: style fixes, sql_join_cache.cc 2017-02-13 18:12:04 +01:00
Sergei Golubchik
ef0db6bfd1 fix rpl_binlog_errors test not to leave dbug enabled 2017-02-13 18:12:04 +01:00
Sergei Golubchik
d2f84ab978 MDEV-10352 Server crashes in Field::set_default on CREATE TABLE
fix Item_default_value not to pretend being const_item
if the field's default_value expression isn't parsed yet
2017-02-13 18:12:04 +01:00
Sergei Golubchik
b6a3917b05 MDEV-11750 Assertion `vfield' failed in TABLE::update_virtual_fields after crash recovery on corrupted MyISAM table
Adjust the length of the BIT field
(same as in _mi_put_key_in_record())
2017-02-13 18:12:04 +01:00
Sergei Golubchik
29ed440d44 MDEV-11836 vcol.vcol_keys_myisam fails in buildbot and outside
move TABLE::key_read into handler. Because in index merge and DS-MRR
there can be many handlers per table, and some of them use
key read while others don't. "keyread" is really per handler,
not per TABLE property.
2017-02-13 18:12:04 +01:00
Sergei Golubchik
eda2ebefba MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
set the correct print precedence for IN subqueries
2017-02-13 18:12:04 +01:00
Sergei Golubchik
cf00393378 Race condition in DEFAULT() with expressions
Item_default_value::calculate was updating table->s->default_values,
but it is supposed to be read-only
2017-02-13 18:12:04 +01:00
Sergei Golubchik
cd4dd2b62d MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4)
Optionally do table->update_default_fields() even for INSERT
that supposedly provides values for all column. Because these
"values" might be DEFAULT, which would need table->update_default_fields()
at the end.

Also set Item_default_value::used_tables() from the default expression.
Non-zero used_field() means that mysql_insert() will initialize all
fields to their default values (with restore_record()) even if
all columns are later provided with values. Because default expressions
may refer to other columns and they must be initialized.
2017-02-13 18:12:04 +01:00
Marko Mäkelä
a45866c6db MDEV-12050 Remove unused InnoDB Memcached hooks
Oracle introduced a Memcached plugin interface to the InnoDB
storage engine in MySQL 5.6. That interface is essentially a
fork of Memcached development snapshot 1.6.0-beta1 of an old
development branch 'engine-pu'.

To my knowledge, there have not been any updates to the Memcached code
between MySQL 5.6 and 5.7; only bug fixes and extensions related to
the Oracle modifications.

The Memcached plugin is not part of the MariaDB Server. Therefore it
does not make sense to include the InnoDB interfaces for the Memcached
plugin, or to have any related configuration parameters:

    innodb_api_bk_commit_interval
    innodb_api_disable_rowlock
    innodb_api_enable_binlog
    innodb_api_enable_mdl
    innodb_api_trx_level

Removing this code in one commit makes it possible to easily restore
it, in case it turns out to be needed later.
2017-02-13 11:24:02 +02:00
Igor Babaev
d35aea5407 Fixed bugs mdev-12051, mdev-10885.
These are different bugs, but the fixing code is the same:
if window functions are used over implicit grouping then
now the execution should follow the general path calling
the function set in JOIN::first_select.
2017-02-12 15:50:14 -08:00
Nirbhay Choubey
f04efa839d MDEV-7635: Fix for ctype_gbk_export_import.test 2017-02-11 11:16:36 -05:00
Sergei Golubchik
f3914d10b6 Merge branch 'bb-10.2-serg-merge' into 10.2 2017-02-11 09:45:34 +01:00
Igor Babaev
5593458062 Fixed bug mdev-12015.
Corrected an assertion in JOIN::create_postjoin_aggr_table():
JOIN::join_tab[0] can be the first aggregation table if
the query uses window functions.
2017-02-10 17:21:45 -08:00
Sergei Golubchik
2195bb4e41 Merge branch '10.1' into 10.2 2017-02-10 17:01:45 +01:00
Elena Stepanova
c513c4cbf5 MDEV-7635: Additional test fixes 2017-02-10 06:30:42 -05:00