Commit graph

177811 commits

Author SHA1 Message Date
Marko Mäkelä
42f657cd2f MDEV-13267 At startup with crash recovery: mtr_t::commit_checkpoint(lsn_t, bool): Assertion `!recv_no_log_write' failed
This is a bogus debug assertion failure that should be possible
starting with MariaDB 10.2.2 (which merged WL#7142 via MySQL 5.7.9).

While generating page-change redo log records is strictly out of the
question during tat certain parts of crash recovery, the
fil_names_clear() is only emitting informational MLOG_FILE_NAME
and MLOG_CHECKPOINT records to guarantee that if the server is killed
during or soon after the crash recovery, subsequent crash recovery
will be possible.

The metadata buffer that fil_names_clear() is flushing to the redo log
is being filled by recv_init_crash_recovery_spaces(), right before
starting to apply redo log, by invoking fil_names_dirty() on every
discovered tablespace for which there are changes to apply.

When it comes to Mariabackup (xtrabackup --prepare), it is strictly out
of the question to generate any redo log whatsoever, because that could
break the restore of incremental backups by causing LSN deviation.
So, the fil_names_dirty() call must be skipped when restoring backups.

recv_recovery_from_checkpoint_start(): Do not invoke fil_names_clear()
when restoring a backup.

mtr_t::commit_checkpoint(): Remove the failing assertion. The only
caller is fil_names_clear(), and it must be called by
recv_recovery_from_checkpoint_start() for normal server startup to be
crash-safe. The debug assertion in mtr_t::commit() will still
catch rogue redo log writes.
2017-07-07 18:40:57 +03:00
Marko Mäkelä
f20693c231 Remove a reference to a non-existent include directory 2017-07-07 11:57:39 +03:00
Daniel Black
3b862aaa10 travis: Debian build - minimise packages, enable ccache
Even disabling the ccache on the Debian build didn't always prevent
the Travis build running out of space.

As an alternative strategy, the number of alternative compilers has been
reduced to save space. This additional space has been partially reused
by the ccache.

Debian build specific packages have been removed from other builds.
2017-07-07 08:27:33 +04:00
Marko Mäkelä
c89c49427d Reduce a test so that it fails less frequently on buildbot
There is an inherent race condition between Mariabackup and the
MariaDB server when the InnoDB redo log is being copied. It is
possible that the tail of the circular redo log is overwriting
the head of the log before Mariabackup gets a chance to read it.
So, we reduce the test to generate less redo log. Also, enable
the test on all supported innodb_page_size.
2017-07-06 23:14:39 +03:00
Marko Mäkelä
d902d43ce7 Merge 10.1 into 10.2 2017-07-06 20:28:08 +03:00
Marko Mäkelä
99d52c45cb Mariabackup: Copy all of the redo log correctly
xtrabackup_copy_log(), xtrabackup_copy_logfile():
Change the Boolean parameter to an enum, with the values
COPY_FIRST, COPY_ONLINE, COPY_LAST.

xtrabackup_copy_log(): Return the latest scanned LSN,
which may be less than the last copied LSN. Remove some
dead code that was duplicating some logic that in 10.2
has been moved to log_group_read_log_seg().

log_copying_thread(): Correct the termination condition.

stop_backup_threads(): Shut down the threads that were
created during backup.
2017-07-06 20:17:46 +03:00
Marko Mäkelä
d7b21a49c2 Mariabackup: Remove unused parameters and fix some memory leaks
Use GET_STR instead of GET_STR_ALLOC, so that the memory will
cannot be leaked. For some reason, calling my_cleanup_options()
on xb_server_options or xb_client_options would not work.
2017-07-06 19:14:44 +03:00
Vladislav Vaintroub
60e6170893 mysqltest - increase size of the "die message".
This reduces the probability having output of external utilities
(e.g mariabackup) truncated.
2017-07-06 14:15:32 +00:00
Vladislav Vaintroub
6f1f911497 MDEV-12445 : Rocksdb does not shutdown worker threads and aborts in memleak check on server shutdown
Disable memory leak check in debug server, if rocksdb is loaded.
There is some subtle bug somewhere in 3rd party code we cannot
do much about.

The bug is manifested as follows

Rocksdb does not shutdown worker threads, when plugin is shut down. Thus
OS does not unload the library since there are some active threads using
this library's code. Thus global destructors in the library do not run,
and there is still some memory allocated when server exits.

The workaround disables server's memory leak check, if rocksdb engine was
loaded.
2017-07-06 11:36:17 +00:00
Vladislav Vaintroub
53d6325db0 Fix assertion in rocksb.
Use thd_query_safe() to read query from a different connection.
2017-07-06 11:35:54 +00:00
Marko Mäkelä
2b5c9bc2c8 MDEV-13247 innodb_log_compressed_pages=OFF breaks crash recovery of ROW_FORMAT=COMPRESSED tables
The option innodb_log_compressed_pages was contributed by
Facebook to MySQL 5.6. It was disabled in the 5.6.10 GA release
due to problems that were fixed in 5.6.11, which is when the
option was enabled.

The option was set to innodb_log_compressed_pages=ON by default
(disabling the feature), because safety was considered more
important than speed. The option innodb_log_compressed_pages=OFF
can *CORRUPT* ROW_FORMAT=COMPRESSED tables on crash recovery
if the zlib deflate function is behaving differently (producing
a different amount of compressed data) from how it behaved
when the redo log records were written (prior to the crash recovery).

In MDEV-6935, the default value was changed to
innodb_log_compressed_pages=OFF. This is inherently unsafe, because
there are very many different environments where MariaDB can be
running, using different zlib versions. While zlib can decompress
data just fine, there are no guarantees that different versions will
always compress the same data to the exactly same size. To avoid
problems related to zlib upgrades or version mismatch, we must
use a safe default setting.

This will reduce the write performance for users of
ROW_FORMAT=COMPRESSED tables. If you configure
innodb_log_compressed_pages=ON, please make sure that you will
always cleanly shut down InnoDB before upgrading the server
or zlib.
2017-07-06 14:18:53 +03:00
Sergey Vojtovich
4e08cdf52a Fixed build failure on Windows 2017-07-06 10:39:21 +04:00
Fredrik Fornwall
7e6a600d13 Remove obsolete synonyms for access bits
Replace S_IREAD, S_IWRITE and S_IEXEC with more modern equivalents.
Fixes building for Android.
2017-07-06 09:52:12 +04:00
Marko Mäkelä
0ff62ad808 InnoDB: Remove a redundant condition and an outdated comment
Since MariaDB 10.2.2, temporary table metadata is not written
to the InnoDB data dictionary tables. Therefore,
the DICT_TF2_TEMPORARY flag cannot be set in SYS_TABLES,
except if there exist orphan temporary tables that were created
before MariaDB 10.2.2.

trx_resurrect_table_locks(): Do not skip temporary tables.
If a resurrect transaction modified a temporary table that was
created before MariaDB 10.2.2, that table would be treated
internally as a persistent table. It is safer to resurrect
locks than to skip the table, because the table would be modified
on transaction rollback.
2017-07-06 02:14:33 +03:00
Elena Stepanova
ec76945dac MDEV-13248 binlog.binlog_parallel_replication_marks_row fails in buildbot
The test did not handle correctly possible difference in system
timezone. The fix is to remove non-functional setting of local
time_zone and instead allow timestamp replacement to work with
any date/time
2017-07-06 00:45:43 +03:00
Marko Mäkelä
72a2de92a1 Avoid a hang when InnoDB startup is aborted during redo log apply
buf_flush_page_cleaner_coordinator: In the first loop, use an
appropriate termination condition, waiting for !recv_writer_thread_active.

logs_empty_and_mark_files_at_shutdown(): Signal recv_sys->flush_start
in case the recv_writer_thread was never started, or
buf_flush_page_cleaner_coordinator failed to notice its termination.

innobase_start_or_create_for_mysql(): Remove a redundant, unreachable
condition, and properly release resources when aborting startup due to
recv_sys->found_corrupt_log.
2017-07-05 22:09:28 +03:00
Sergei Golubchik
f6633bf058 Merge branch '10.1' into 10.2 2017-07-05 19:08:55 +02:00
Eugene Kosov
4693f01f57 Fix warning discovered by ASAN
Patch submitted by Eugene Kosov <claprix@yandex.ru>,
comments added by commiter.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
2017-07-05 18:28:38 +03:00
Sergei Golubchik
fc5932a1b7 update libmariadb 2017-07-05 17:15:59 +02:00
Sergei Golubchik
1ea3c93fda MDEV-9144 JSON data type
for compatibility with MySQL, add 'JSON' as an alias for 'TEXT'
2017-07-05 17:15:59 +02:00
Sergei Golubchik
51d457f371 compilation failures
with -DPLUGIN_PARTITION=NO and -DPLUGIN_PERFSCHEMA=NO
2017-07-05 17:15:59 +02:00
Sergei Golubchik
291411c96c MDEV-13132 Information Schema does not show whether column default is expression or literal
Fix INFORMATION_SCHEMA.COLUMNS.COLUMN_DEFAULT to be standard-compliant,
but keep SHOW COLUMNS backward-compatibly unchanged.
2017-07-05 17:15:59 +02:00
Sergei Golubchik
0559f12972 MDEV-13209 Cross-database operation with virtual columns fails
if we don't need to print field's table name,
we surely don't need to print field's db name either
2017-07-05 17:15:59 +02:00
Sergei Golubchik
186075adf2 MDEV-12938 Discrepancy between mysql_config and mariadb_config
Use the correct target name when querying libmariadb.so dependencies.
Filter out linker options (no-undefined and the version script)
2017-07-05 17:15:59 +02:00
Sergei Golubchik
d2d52305b4 MDEV-12755 Replication tests fail in buildbot with ASAN
remove double-initialization of MYSQL structure
2017-07-05 17:15:59 +02:00
Sergei Golubchik
cf9c290563 MDEV-12738 main.default fails with valgrind in buildbot and outside 2017-07-05 17:15:59 +02:00
Sergei Golubchik
48c22a68b1 MDEV-13089 identifier quoting in partitioning
remove ANSI_QUOTES when generating partition syntax for frm
2017-07-05 17:15:59 +02:00
Sergei Golubchik
e1093e2464 cleanup: part_func_string and subpart_func_string
Remove now-unused part_func_string and subpart_func_string
from partition_info.
2017-07-05 17:15:59 +02:00
Sergei Golubchik
785e2248bd MDEV-13089 identifier quoting in partitioning
don't print partitioning expression as it was entered by the user,
use Item::print() according to the sql_mode and sql_quote_show_create
2017-07-05 17:15:59 +02:00
Sergei Golubchik
504eff0ca1 cleanup: generate_partition_syntax()
Don't write to a temporary file, use String.
Remove strange one-liner "helpers", use String methods.
Don't use current_thd, don't allocate memory for 1-byte strings, etc.
2017-07-05 17:15:58 +02:00
Sergei Golubchik
03c52e964f cleanup: move Virtual_column_info::print out of Virtual_column_info 2017-07-05 17:15:58 +02:00
Sergei Golubchik
2bf017c210 MDEV-13060 Server Audit Plugin Crashes with AWS KMS plugin
don't do auditing if thd is NULL.

Collaterals:
* copy-paste bugs server_audit.c
* uninitialized user field when thd in NULL
2017-07-05 17:15:58 +02:00
Sergei Golubchik
47687eef41 MDEV-12936 upgrade to 10.2.6 failed upon tables with virtual columns
when opening 10.1- table that has virtual columns:

1. don't error out if it has vcols over autoinc columns.
   just issue a warning.
2. set vcol type properly
3. in innodb: use table->s->stored_fields instead of table->s->fields,
   because that's what was stored in innodb data dictionary
2017-07-05 17:15:58 +02:00
Sergei Golubchik
75f80004b1 MDEV-12939 A query crashes MariaDB in Item_func_regex::cleanup
and
MDEV-13144 regexp on views - crashed mariadb server

implement Item_func_regex::build_clone()
2017-07-05 17:15:57 +02:00
Sergei Golubchik
7bea860709 MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE
use correct type for Alter_inplace_info flags.
2017-07-05 17:15:57 +02:00
Sergei Golubchik
9edfc00697 MDEV-11930 Unexpected ER_ERROR_EVALUATING_EXPRESSION warning upon dropping database with a bad table
DBUG_EXECUTE_IF was wrong, it used my_error, but didn't do error=1.

It's not clear what it was actually testing, what it was supposed
to be testing, and what it has to do with bug#43138, so I removed it.
2017-07-05 17:15:57 +02:00
Sergei Golubchik
93a95c0a76 cleanup: check_openssl_compatibility()
CRYPTO_set_mem_functions() works only until the first allocation is done:
* remove the second CRYPTO_set_mem_functions() call
* check whether the first CRYPTO_set_mem_functions() call worked
* stricter memory checks (==1, not >1, etc)
* as coc_malloc cannot be removed, make the counter a bit cheaper
* only do the check for OpenSSL 1.1 (because of OpenSSL 1.0 bug)
2017-07-05 17:15:57 +02:00
Sergei Golubchik
a6bef22cda reduce grammar duplication 2017-07-05 17:15:57 +02:00
Sergei Golubchik
c917ba1d51 fix the comparison in st_select_lex::setup_ref_array()
the array only needs to be reallocated if it's smaller
than needed. Being larger is ok.

also: remove a duplicated check (merge error)
2017-07-05 17:15:57 +02:00
Sergei Golubchik
5c30fcfa2f cleanup: C++ comments 2017-07-05 17:15:57 +02:00
Sergei Golubchik
05873ffbf7 MDEV-12795 Possibly orphan mysql-test/t/mysql_plugin-master.opt 2017-07-05 17:15:57 +02:00
Sergei Golubchik
32e3b02234 MDEV-11639 Server crashes in update_virtual_field, gcol.innodb_virtual_basic fails in buildbot
don't use thd->query_id check in background purge threads
(it doesn't work, because thd->query_id is never incremented there)
instead use thd->open_tables directly, there can be only one table
there anyway, and this is the table opened by this purge thread.
2017-07-05 17:15:57 +02:00
Sergei Golubchik
95e6dd443a crashes when errors on early startup
cannot use unireg_abort() until mutexes are initialized.
2017-07-05 17:15:57 +02:00
Sergei Golubchik
0e6c6d61c2 fix main.mdl failure in --embedded 2017-07-05 17:15:57 +02:00
Sergei Golubchik
e022c22ba8 update sysvar_server_embedded.result on 32bit 2017-07-05 17:15:57 +02:00
Marko Mäkelä
10a98a4992 Adjust a test for Windows
On Windows, when tmpdir is not writable, there are only messages
like this:

2017-07-05 14:04:25 3860 [ERROR] InnoDB: Unable to create temporary file; errno: 0

On other platforms, there would be two messages for each failure:

2017-07-05 17:23:02 140436573771648 [ERROR] mysqld: Can't create/write to file '/dev/null/nonexistent/ibaajU4U' (Errcode: 20 "Not a directory")
2017-07-05 17:23:02 140436573771648 [ERROR] InnoDB: Unable to create temporary file; errno: 20
2017-07-05 17:22:53 +03:00
Vicențiu Ciorbaru
4f93c732d5 MDEV-13189: Window functions crash when using INTERVAL
Interval function makes use of Item_row. Item_row did not correctly mark
with_window_func flag according to its arguments. Fix it by making
Item_row aware of this flag.
2017-07-05 15:40:25 +03:00
Marko Mäkelä
e555540ab6 MDEV-13105 InnoDB fails to load a table with PAGE_COMPRESSION_LEVEL after upgrade from 10.1.20
When using innodb_page_size=16k, InnoDB tables
that were created in MariaDB 10.1.0 to 10.1.20 with
PAGE_COMPRESSED=1 and
PAGE_COMPRESSION_LEVEL=2 or PAGE_COMPRESSION_LEVEL=3
would fail to load.

fsp_flags_is_valid(): When using innodb_page_size=16k, use a
more strict check for .ibd files, with the assumption that
nobody would try to use different-page-size files.
2017-07-05 14:55:56 +03:00
Marko Mäkelä
e3d3147792 MDEV-13105 InnoDB fails to load a table with PAGE_COMPRESSION_LEVEL after upgrade from 10.1.20
When using innodb_page_size=16k, InnoDB tables
that were created in MariaDB 10.1.0 to 10.1.20 with
PAGE_COMPRESSED=1 and
PAGE_COMPRESSION_LEVEL=2 or PAGE_COMPRESSION_LEVEL=3
would fail to load.

fsp_flags_is_valid(): When using innodb_page_size=16k, use a
more strict check for .ibd files, with the assumption that
nobody would try to use different-page-size files.
2017-07-05 14:35:55 +03:00
Vladislav Vaintroub
f2931b1e3a mariabackup : run tests on buildbot on Windows 2017-07-05 11:34:34 +00:00