Commit graph

177736 commits

Author SHA1 Message Date
Marko Mäkelä
6a9b216301 Fix clang -Wunused-private-field 2019-04-03 19:50:51 +03:00
Marko Mäkelä
1f3bcff1f2 Remove unused declarations 2019-04-03 19:46:34 +03:00
Marko Mäkelä
fa14784301 Fix more -Wnonnull-compare
For some reason, GCC 8 did not issue warnings for all such comparisons.
2019-04-03 19:21:54 +03:00
Marko Mäkelä
c0fca2863b Fix -Wnonnull-compare
InnoDB and XtraDB had redundant assertions for checking that
function parameters that were declared as nonnull were not NULL.
2019-04-03 09:46:49 +03:00
Sergei Golubchik
65d758aa89 MDEV-18298 Crashes server with segfault during role grants
it was supposed to be `*(p-1)` not `*p-1`
(the crash happens if `*p==0`)
2019-04-02 18:22:37 +02:00
Sergei Golubchik
409f69cd74 cmake: only search for libraries that are needed
in particular, don't search for libjemalloc.a, which is only
needed for tokudb's ftcxx tests, when the tests aren't going
to be built.
2019-04-02 18:22:37 +02:00
Sergei Golubchik
7b527e6334 cmake: fix krb5 detection on SUSE
`zypper install krb5-devel` installs executables outside of $PATH.
It also installs /etc/profile.d/krb5.sh that is sourced by a new
shell to add the new location to the $PATH. But this doesn't affect
the current shell.

Now decent Linux distros remind the user to run `. /etc/profile`
to reload paths in such a case. SUSE doesn't and for a good reason -
it doesn't work there. Because SUSE sets PROFILEREAD=true in the
environment and /etc/profile does not do anything.

By this point, one should not really expect `unset PROFILEREAD` to help,
and it does not - PROFILEREAD is readonly, and cannot be unset.

Apparently SUSE really *really* wants you to re-login between installing
MariaDB build dependencies and actually running the rpmbuild.

Which we cannot do it buildbot. And it would look very user-un-friendly
in the Build Instructions section of the manual.

So, we work around it - by adding SUSE krb5 path to the search list.

THIS IS SUSEEEEEE!!!
2019-04-02 18:22:37 +02:00
Sergei Golubchik
0b2042fdca speedup RPM builds
Filter out most common file types from automatic dependency collection.
This makes `make package`  in centos73 VM three times faster
2019-04-02 18:22:37 +02:00
Marko Mäkelä
b88f378648 Omit the definition of unused function yyset_extra()
This is follow-up for commit 619d22dde5
to fix the cmake -DWITH_EMBEDDED_SERVER build.
2019-04-02 08:50:53 +03:00
Marko Mäkelä
619d22dde5 Rebuild the InnoDB lexical analyzers with flex 2.6.4
InnoDB includes 3 parsers, which use 3 lexical analyzers that
are generated with flex. Flex versions before 2.6 emitted
the keyword "register", which is deprecated in C++17.

The lexical analyzers were regenerated as follows:

for s in storage/innobase storage/xtradb
do
	(cd "$s"/pars; ./make_flex.sh)
	touch "$s"/fts/*.l
	make -C "$s"/fts -f Makefile.query
done
2019-04-01 13:03:18 +03:00
Marko Mäkelä
23eeecd68f MDEV-19111 Unused field INFORMATION_SCHEMA.INNODB_TABLESPACES_SCRUBBING.ROTATING_OR_FLUSHING
The MDEV-11738/MDEV-11581 fix was supposed to add the column
ROTATING_OR_FLUSHING to the INFORMATION_SCHEMA table
INNODB_TABLESPACES_ENCRYPTION, but it also added that column to
INNODB_TABLESPACES_SCRUBBING in InnoDB (not XtraDB).

The extra column was never initialized. We will remove it,
because key rotation has nothing to do with the scrubbing of
tablespace data.
2019-04-01 10:32:03 +03:00
Marko Mäkelä
d0116e10a5 Revert MDEV-18464 and MDEV-12009
This reverts commit 21b2fada7a
and commit 81d71ee6b2.

The MDEV-18464 change introduces a few data race issues. Contrary to
the documentation, the field trx_t::victim is not always being protected
by lock_sys_t::mutex and trx_t::mutex. Most importantly, it seems
that KILL QUERY could wrongly avoid acquiring both mutexes when
invoking lock_trx_handle_wait_low(), in case another thread had
already set trx->victim=true.

We also revert MDEV-12009, because it should depend on the MDEV-18464
fix being present.
2019-03-28 12:39:50 +02:00
Jan Lindström
81d71ee6b2 MDEV-12009: Allow to force kill user threads/query which are flagged as high priority by Galera
As noted on kill_one_thread SUPER should be able to kill even
system threads i.e. threads/query flagged as high priority or
wsrep applier thread. Normal user, should not able to kill
threads/query flagged as high priority (BF) or wsrep applier
thread.
2019-03-28 08:43:44 +02:00
Jan Lindström
21b2fada7a MDEV-18464: Port kill_one_trx fixes from 10.4 to 10.1
Pushed the decision for innodb transaction and system
locking down to lock0lock.cc level. With this,
we can avoid releasing these mutexes for executions
where these mutexes were acquired upfront.

This patch will also fix BF aborting of native threads, e.g.
threads which have declared wsrep_on=OFF. Earlier, we have
used, for innodb trx locks, was_chosen_as_deadlock_victim
flag, for marking inodb transactions, which are victims for
wsrep BF abort. With native threads (wsrep_on==OFF), re-using
was_chosen_as_deadlock_victim flag may lead to inteference
with real deadlock, and to deal with this, the patch has added new
flag for marking wsrep BF aborts only: victim=true

Similar way if replication decides to abort one of the threads
we mark victim by: victim=true

innobase_kill_query
	Remove lock sys and trx mutex handling.

wsrep_innobase_kill_one_trx
	Mark victim trx with victim=true

trx0trx.h
	Remove trx_abort_t type and abort type variable from
	trx struct. Add victim variable to trx.

wsrep_kill_victim
	Remove abort_type

lock_report_waiters_to_mysql
	Take also trx mutex and mark trx as a victim for
	replication abort.

lock_trx_handle_wait_low
	New low level function to check whether the transaction
	has already been rolled back because it was selected as
	a deadlock victim, or if it has to wait then cancel
	the wait lock.

lock_trx_handle_wait
	If transaction is not marked as victim take lock sys
	and trx mutex before calling lock_trx_handle_wait_low
	and release them after that.

row_search_for_mysql
	Remove lock sys and trx mutex taking and releasing.

trx_rollback_to_savepoint_for_mysql_low
trx_commit_in_memory
	Clean up victim variable.
2019-03-28 07:40:03 +02:00
Sergei Golubchik
deff3f7572 MDEV-18466 Unsafe to log updates on tables referenced by foreign keys with triggers in statement format
ignore FK-prelocked tables when looking for write-prelocked tables
with auto-increment to complain about "Statement is unsafe because
it invokes a trigger or a stored function that inserts into an
AUTO_INCREMENT column"
2019-03-27 22:51:37 +01:00
Sergei Golubchik
d8084116b5 MDEV-7066 No Source RPMs ... (and so no "yum-builddep MariaDB-server" either)
special cases:

* change systemd detection to use CHECK_LIBRARY_EXISTS at least once,
  to have it detected by build_depends.cmake
* similarly, use find_library for pam
* unixODBC is weird, libodbc.so is in the unixODBC package, not
  in the unixODBC-devel, where normally all .so files belong.
  Packaging bug? As a workaround, use find_file(sql.h) instead of
  find_path(sql.h) to make sure that /usr/include/sql.h (not /usr/include)
  is cached by cmake, and later build_depends.cmake will select
  unixODBC-devel, as a package owning /usr/include/sql.h file.
2019-03-27 22:51:37 +01:00
Sergei Golubchik
b12f14965d MDEV-7066 No Source RPMs ... (and so no "yum-builddep MariaDB-server" either)
automatic BuildRequires for source RPM: for every FILEPATH and
"Have library XXX" cached variable, detect what rpm package it comes from
and add it to the list of dependencies.

That is, the source RPM will BuildRequire all those packages that
were found by cmake when the source RPM was built. Presumably, our
CMakeLists.txt won't check for libraries that aren't needed for a build.

It supports libraries/executables/files found with
  FIND_LIBRARY
  FIND_FILE
  FIND_PROGRAM
  CHECK_LIBRARY_EXISTS
2019-03-27 22:51:37 +01:00
Sergei Golubchik
ecc2711328 MDEV-7066 No Source RPMs ... (and so no "yum-builddep MariaDB-server" either)
create source RPM cpack-way

when building binary packages, this source rpm will use
same BUILD_CONFIG and WITH_SSL values that were used when
creating the source RPM.

Only do it for a reasonably new cmake, where
source rpms are known to work (3.10.2 is ok, 3.5.2 is not).

And force a shorter CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX so that
a source rpm could be built from a standard location in /usr/src
2019-03-27 22:51:37 +01:00
Sergei Golubchik
86e80f944f cmake: don't do fake rpm Provides
instead remove internal modules from Requires/Provides
2019-03-27 22:51:37 +01:00
Sergei Golubchik
39cea72e7b cmake: fix cpack_source_ignore_files
add defensive $ for filenames, don't include .gitattributes
and *.rpm, correct rules for *.gz and *.zip
2019-03-27 22:51:37 +01:00
Sergei Golubchik
6417297180 cmake: remove workarounds for cmake bugs #13248 and #12864
since long we use a different workaround, our own CPackRPM wrapper
2019-03-27 22:51:37 +01:00
Sergei Golubchik
f97d879bf8 cmake: re-enable -Werror in the maintainer mode
now we can afford it. Fix -Werror errors. Note:
* old gcc is bad at detecting uninit variables, disable it.
* time_t is int or long, cast it for printf's
2019-03-27 22:51:37 +01:00
Sergei Golubchik
1a4746e128 Merge branch '5.5' into 10.1 2019-03-27 19:35:03 +01:00
Vladislav Vaintroub
9a8b8ea66b MDEV-19060 : mariabackup continues, despite failing to open a tablespace
Fix mariabackup to crash if opening tablespace fails, insitead of
continuing after an error.
2019-03-27 14:38:21 +01:00
Marko Mäkelä
a6585d5ce9 Merge 10.0 into 10.1 2019-03-27 11:56:08 +02:00
Marko Mäkelä
828cc2ba7c MDEV-18417/MDEV-18656/MDEV-18417: Work around compiler ASAN bug
In a Ubuntu Xenial build environment, the compiler identified as
g++-5.real (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
seems to be emitting incorrect code for the compilation unit
trx0rec.cc, triggering a bogus-looking AddressSanitizer report
of an invalid read of something in the function trx_undo_rec_get_pars().
This is potentially affecting any larger tests where the InnoDB
purge subsystem is being exercised.

When the optimization level of trx0rec.cc is limited to -O1, no
bogus failure is being reported. With -O2 or -O3, a lot of things
seemed to be inlined in the function, and the disassembly of the
generated code did not make sense to me.
2019-03-27 11:54:34 +02:00
Sujatha Sivakumar
f2d549d8db MDEV-14784: Slave crashes in show_status_array upon running a trigger with
select from I_S

Problem:
========
When applier thread tries to access 'variable_name' of
INFORMATION_SCHEMA.SESSION_VARIABLES table through triggers, it results in an
abnormal exit of slave server.

Analysis:
========
At the time of replication of stored routines and triggers, their associated
security context will be sent by the master. The applier thread on the slave
server will use this information to set the required security context for the
execution of stored routines and triggers. This is achieved as follows.

->The stored routine object has a member named 'm_security_ctx' which holds the
  security context received from master.
->The applier thread's security_ctx is stored into a 'backup' object.

->Set the applier thread's security_ctx to 'm_security_ctx'.

->Upon the completion of stored routine execution restore the original security
  context of applier thread from the backup.

During the above process the 'm_security_ctx' object is not initialized
properly. Hence the 'external_user' of 'm_security_ctx' has invalid value for
this variable and accessing this variable results in abnormal exit of server.

Fix:
===
Invoke the Security_context::init() call from the constructor of stored routine
so that 'm_security_ctx' gets initialized properly.
2019-03-27 12:34:03 +05:30
Marko Mäkelä
762419a573 Fixup for MDEV-18968
Item_cond::eval_not_null_tables(): Use Item::eval_const_cond(),
just like Item_cond::fix_fields().

This inconsistency was found while merging to 10.3, where the
Microsoft compiler is configured to report an error for comparing
longlong to bool.
2019-03-26 17:21:34 +02:00
Marko Mäkelä
f2c1c9590c Fix cmake -DENABLED_PROFILING=OFF 2019-03-26 14:57:53 +02:00
Marko Mäkelä
1933cf98e8 Merge 5.5 into 10.0 2019-03-26 14:13:46 +02:00
Marko Mäkelä
42fd537244 Merge 10.0 into 10.1 2019-03-26 13:51:40 +02:00
Marko Mäkelä
065ba53ccb MDEV-12711 mariabackup --backup is refused for multi-file system tablespace
Before MDEV-12113 (MariaDB Server 10.1.25), on shutdown InnoDB would write
the current LSN to the first page of each file of the system tablespace.
This is incompatible with MariaDB's InnoDB table encryption, because
encryption repurposed the field for an encryption key ID and checksum.

buf_page_is_corrupted(): For the InnoDB system tablespace, skip
FIL_PAGE_FILE_FLUSH_LSN when checking if a page is all zero,
because the first page of each file in the system tablespace can
contain nonzero bytes in the field.
2019-03-26 13:51:15 +02:00
Alexander Barkov
6fbbb0853e MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty set 2019-03-26 11:37:18 +04:00
Sergey Vojtovich
e890711279 Fixed ps-protocol thread_pool_server_audit failure
By applying 7bd258c.
2019-03-26 00:56:41 +04:00
Bernhard M. Wiedemann
cfe0fe1ad1 Fix tests in 2020
unfortunately, the year 2038 problem prevented me from pushing
the deadline even further into the future.
2019-03-26 00:56:41 +04:00
Chris Calender
c61e8a6597 Fix for MDEV-17449, typo in error message (#1146) 2019-03-24 21:24:28 +04:00
Chris Calender
d8b7e76c37 Fix for MDEV-18276, typo in error message + all other occurrences of refering 2019-03-23 00:00:47 +04:00
FaramosCZ
ed643f4bb3 Fix resource leak
The 'bitmap_dir' has to be closed when no longer needed
2019-03-22 16:19:30 +04:00
Alexander Barkov
f704361cd6 Backporting slow log simulation logic details from 10.2 to 10.1
Simulate slow statements only for COM_QUERY and COM_STMT_EXECUTE commands,
to exclude mysqld_stmt_prepare() and mysqld_stmt_close() entries from the log,
as they are not relevant for log_slow_debug.test. This simplifies the test.
2019-03-22 15:56:45 +04:00
FaramosCZ
9c9bf9642e Fix resource leak 2019-03-22 15:48:26 +04:00
FaramosCZ
89e390b7ce Fix resource leak 2019-03-22 15:20:56 +04:00
FaramosCZ
9ff713d33a Fix resource leak 2019-03-22 14:52:30 +04:00
sachin
778c525ff8 MDEV-17119 replicate_rewrite_db does not work for single chardatabase name
Fixed issue in logic.
2019-03-22 12:13:24 +05:30
FaramosCZ
8be02be08b Fix USE_AFTER_FREE (CWE-672)
The file will be closed on line 540
2019-03-22 02:32:47 +04:00
FaramosCZ
137812c88a Fix USE_AFTER_FREE (CWE-416)
swap two lines
2019-03-22 01:42:04 +04:00
chriscalender
f00e25b4c4 Fix for MDEV-15538, '-N' Produce html output wrong 2019-03-22 01:01:59 +04:00
Chris Calender
9d2d80aace Update sql_parse.cc
Corrected one more "refering" typo.
2019-03-22 00:40:32 +04:00
Marko Mäkelä
8c493a910f Merge 10.0 into 10.1 2019-03-21 21:06:01 +02:00
Marko Mäkelä
925b503058 Merge 5.5 into 10.0 2019-03-21 10:34:00 +02:00
Marko Mäkelä
5d454181a8 MDEV-6262 follow-up: Ensure NUL termination on strncpy() 2019-03-21 10:29:59 +02:00