Commit graph

186890 commits

Author SHA1 Message Date
Marko Mäkelä
a7e9395f9d fts_sync_table(), fts_sync() dead code removal
fts_sync(): Remove the constant parameter has_dict=false.

fts_sync_table(): Remove the constant parameter has_dict=false,
and the redundant parameter unlock_cache = !wait.
Make wait=true the default parameter.
2019-07-25 13:34:36 +03:00
Marko Mäkelä
7de38492fc After-merge fix: cmake -DPLUGIN_PERFSCHEMA=NO
An #include was forgotten in b6ac67389d
2019-07-25 13:34:31 +03:00
Marko Mäkelä
a3455c6085 MDEV-20133 Merge new release of InnoDB 5.7.27 to 10.2 2019-07-25 13:08:46 +03:00
Aditya A
60069a9829 Bug #29127203 VIRTUAL GENERATED COLUMN INDEX DATA INCONSISTENCY
PROBLEM
-------

Index defined on a virtual column whose base column was in a fk
relation was not getting updated. This is because while getting
the updated field information from the update vector of the parent
table we were comparing the column number of the base column (for
virtual column) in child table with the associated column number
in the parent table. There was a mismatch in this column number
because of which this update field information was skipped and
subsequently index was not getting updated.

FIX
2019-07-25 12:39:39 +03:00
Marko Mäkelä
b6ac67389d Merge 10.1 into 10.2 2019-07-25 12:14:27 +03:00
Sujatha
8d0dabc56b MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged
Fixing post push test issues.

Recorded the result files for following:
rpl_stm_drop_create_temp_table.result
rpl_mixed_drop_create_temp_table.result.
2019-07-25 14:24:04 +05:30
Marko Mäkelä
f6ea0389a4 Replace ut_timer() with my_interval_timer()
The function pointer ut_timer() was only used by the
InnoDB defragmenting thread. Let InnoDB use a single monotonic
high-precision timer, my_interval_timer() [in nanoseconds],
occasionally wrapped by microsecond_interval_timer().

srv_defragment_interval: Change from "timer" units to nanoseconds.

This concludes the InnoDB time function cleanup that was
motivated by MDEV-14154. Only ut_time_ms() will remain for now,
wrapping my_interval_timer().
2019-07-25 10:43:11 +03:00
Anel Husakovic
ee555f8fc5 MDEV-19948 SHOW GRANTS return privileges individually update in 10.2 2019-07-24 23:27:10 -07:00
Anel Husakovic
55d8ff0de8 MDEV-19948 SHOW GRANTS FOR user return privileges individually 2019-07-24 23:19:43 -07:00
Sujatha
e32f29b7f3 MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged
MDEV-5589 commit set up a policy to skip DROP TEMPORARY TABLE binary logging
in case the target table has not been "CREATEed" in binlog (no CREATE
Query-log-event was logged into the binary log).

It turns out that

1. the rule did not cover non-existing table DROPped with IF-EXISTS clause.
   The logged-create knowledge for the non-existing one does not even need
   MDEV-5589 patch, and

2. connection close disobeys it to trigger automatic DROP-IF-EXISTS
   binlogging.

Either 1 or 2 or even both is/are also responsible for unexpected binlog
records observed in MDEV-17863, actually rendering a referred
@@global.read_only irrelevant as far as the described stored procedure
definition *and* the ROW binlog-format are concerned.
2019-07-25 11:38:45 +05:30
Elena Stepanova
17794fb9aa List of unstable tests for 10.4.7 release 2019-07-25 03:10:18 +03:00
Marko Mäkelä
0c7c61019d Remove the wrappers ut_time(), ut_difftime(), ib_time_t 2019-07-24 21:59:26 +03:00
Marko Mäkelä
c663a9414b MDEV-14154: Failing assertion: slot->last_run <= current_time in fts0opt.cc
The FTS optimizer thread made a false assumption that time(NULL)
is monotonic. The system clock can be adjusted to the past,
for example if the hardware clock was drifting to the future,
and it was adjusted by NTP.

fts_slot_t::interval_time: Replace with the constant
FTS_OPTIMIZE_INTERVAL_IN_SECS.

fts_slot_t::last_run, fts_slot_t::completed: Clarify the
documentation.

fts_optimize_get_time_limit(): Remove a type cast, and
add a FIXME comment about domain mismatch.

fts_optimize_compact(), fts_optimize_words(): Limit the time
also when the current time has been moved to the past.

fts_optimize_table_bk(): Check for wrap-around.

fts_optimize_how_many(): Check for wrap-around, and remove the
failing assertions.

fts_is_sync_needed(): Remove a redundant call to time(NULL).
2019-07-24 21:59:26 +03:00
Marko Mäkelä
9e5df96751 Reduce the amount of time(NULL) calls for lock processing
lock_t::requested_time: Document what the field is used for.

lock_t::wait_time: Document that the field is only used for
diagnostics and may be garbage if the system time is being adjusted.

srv_slot_t::suspend_time: Document that this is duplicating
trx_lock_t::wait_started.

lock_table_print(), lock_rec_print(): Declare in static scope.
Add a parameter for the current time.

lock_deadlock_check_and_resolve(), lock_deadlock_lock_print(),
lock_deadlock_joining_trx_print():
Add a parameter for the current time.
2019-07-24 21:59:26 +03:00
Marko Mäkelä
2b5bc761d3 MDEV-14154: Document some time_t fields better
srv_slot_t::suspend_time, os_aio_slot_t::reservation_time,
sync_cell_t::reservation_time: Explain what could happen
if the system time has is being adjusted.

fts_sync_t::start_time: Document that the field is mostly unused.
2019-07-24 21:59:26 +03:00
Marko Mäkelä
10727b6953 Always initialize trx_t::start_time_micro
This affects the function has_higher_priority() for internal or
recovered transactions.
2019-07-24 21:59:26 +03:00
Marko Mäkelä
10ee1b95b8 Remove ut_usectime(), ut_gettimeofday()
Replace ut_usectime() with my_interval_timer(),
which is equivalent, but monotonically counting nanoseconds
instead of counting the microseconds of real time.

os_event_wait_time_low(): Use my_hrtime() instead of ut_usectime().

FIXME: Set a clock attribute on the condition variable that allows
a monotonic clock to be chosen as the time base, so that the wait
is immune to adjustments of the system clock.
2019-07-24 21:59:26 +03:00
Marko Mäkelä
e764d5bc01 Correct the type of a parameter 2019-07-24 21:21:54 +03:00
Marko Mäkelä
ab6dd77408 MDEV-14154: Remove ut_time_us()
Use microsecond_interval_timer()
or my_interval_timer() [in nanoseconds] instead.
2019-07-24 21:21:54 +03:00
Elena Stepanova
0d99ccea1e List of unstable tests for 10.3.17 release 2019-07-24 20:35:21 +03:00
Marko Mäkelä
86767f4ac1 Remove unused ut_get_year_month_day() 2019-07-24 19:41:59 +03:00
Nisha Gopalakrishnan
2536c0b1eb BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN WITH TEMPORARY TABLE -> ERRORS
Analysis
========
Point in time recovery using mysqlbinlog containing queries
operating on temporary tables results in an error.

While writing the query log event in the binary log, the
thread id used for execution of DROP TABLE and DELETE commands
were incorrect. The thread variable 'thread_specific_used'
is used to determine whether a specific thread id is to used
while executing the statements i.e using 'SET
@@session.pseudo_thread_id'. This variable was not set
correctly for DROP TABLE query and was never set for DELETE
query. The thread id is important for temporary tables
since the tables are session specific. DROP TABLE and DELETE
queries executed using a wrong thread id resulted in errors
while applying the queries generated by mysqlbinlog utility.

Fix
===
Set the 'thread_specific_used' THD variable for DROP TABLE and
DELETE queries.

ReviewBoard: 21833
2019-07-24 18:32:24 +02:00
Gleb Shchepa
7473a71a28 Bug #29419820: MEMORY LEAK IN MY_YYOVERFLOW()
Note: this patch is for 5.6.

Detected by ASAN.

The patch fixes the cleanup of parser stack pointers.

Reviewed-by: Guilhem Bichot <guilhem.bichot@oracle.com>
2019-07-24 18:32:24 +02:00
Sergei Golubchik
8ddb7e3eb7 Bug#27167197 USING ? IN INSTALL PLUGIN QUERY ABORTS DEBUG, AND HANGS OPTIMIZED SERVER
check_valid_path() uses my_strcspn() that cannot handle invalid characters
properly. This is fixed by a big refactoring in 10.2 (MDEV-6353).

For 5.5, let's simply swap tests, because check_string_char_length()
rejects invalid characters just fine.
2019-07-24 18:32:24 +02:00
Sergei Golubchik
5e8ab9b7af Bug#27302459: EMPTY VALUE IN MYSQL.PLUGIN TABLE CAUSES SERVER TO EXIT ON STARTUP
Description:- During server startup, the server exits if
the 'mysql.plugin' system table has any rows with empty
value for the field 'name' (plugin name).
2019-07-24 18:32:24 +02:00
Georgi Kodinov
c5e9674300 Bug #27312862: ASAN: HEAP-USE-AFTER-FREE: UPDATEXML RB#21666 RB#21666
The xpath parsing function was using a local string buffer that was
deallocated when going out of scope. However references to it are
preserved in the XPATH parse tree. This was causing read-after-free.

Fixed by making the xpath buffer a local variable inside the Item
class for the relevant xpath function, thus being preserved for the
duration of the query.
2019-07-24 18:32:24 +02:00
Anushree Prakash B
9c6777c03c Bug#27259654 - ISSUES FOUND BY PVS-STUDIO STATIC ANALYZER
DESCRIPTION
===========
PVS-Studio static code analyzer found several suspicious
fragments of code across various files.

i)   sizeof() is using the pointer
ii)  memcpy() doesn't copy the whole string.
iii) enumeration constant 'wkb_multilinestring' is used as
     a variable of a Boolean-type.
iv) 'throw' keyword is missing from std::runtime_error()

FIX
===
i)   Use sizeof({actual object/data type})
ii)  Use strncpy() and set last char as '\0'
iii) N/A (Issue has already been fixed)
iv)  Add 'throw' before the exception.

RB: 21502
2019-07-24 18:32:24 +02:00
Sergei Golubchik
11f3e23662 MDEV-19876 pam v2: auth_pam_tool_dir and auth_pam_tool permissions are wrong in RPMs
unconditionally set correct filesystem ownership/permissions for the PAM v2 plugin
in all cases, be it install, reinstall, or upgrade
2019-07-24 17:48:59 +02:00
Sergei Golubchik
c9f0f88838 MDEV-19822 MariaDB 10.4 install fails on Ubuntu 18.04 if Prometheus mysqld_exporter is running 2019-07-24 17:48:59 +02:00
Marko Mäkelä
b951fc4e7f Merge 10.2 into 10.3 2019-07-24 15:34:24 +03:00
Marko Mäkelä
33215edcba Resolve conflicts in wsrep.variables
This was forgotten in the merge 0f83c8878d
because the test is disabled.
2019-07-24 15:30:27 +03:00
Oleksandr Byelkin
bccd9d0e3a MDEV-20108: [ERROR] mysqld got signal 11 in st_select_lex::add_table_to_list
Use the same select as for usual table list.
2019-07-24 13:20:36 +02:00
Thirunarayanan Balathandayuthapani
8fb39b2c35 MDEV-19870 gcol.innodb_virtual_debug_purge doesn't fail if row_vers_old_has_index_entry gives wrong result
1) Whenever purge thread tries to remove the secondary virtual index
entry, purge thread acquires metadata lock for the table and release
dict_operation_lock. After that, it retries the secondary index
deletion if MDL acquired successfully.

2) Inside row_vers_old_has_index_entry(), Change the safe_to_purge
to unsafe_to_purge goto statement. So it can be more appropriate to
return true if it is unsafe_to_purge.

3) Previously, row_vers_old_has_index_entry() returns false if InnoDB
fetched the MDL on the table for the first time. This check(two cases)
should checked only during purge thread. In row_purge_poss_sec(), again
InnoDB checks whether the MDL fetched for the first time. If it is then
InnoDB retry the secondary index deletion logic. So in that case,
InnoDB have to clean up the memory used inside row_vers_old_has_index_entry()
and shouldn't care about return value.
2019-07-24 16:45:05 +05:30
Elena Stepanova
c22305f050 List of unstable tests for 10.2.26 release 2019-07-24 12:52:35 +03:00
Elena Stepanova
c83663e574 List of unstable tests for 10.1.41 release 2019-07-24 00:43:21 +03:00
Marko Mäkelä
97055e6b11 MDEV-14154: Remove ut_time_us()
Use microsecond_interval_timer()
or my_interval_timer() [in nanoseconds] instead.
2019-07-23 17:25:02 +03:00
Marko Mäkelä
058c385e03 Merge 10.1 into 10.2 2019-07-23 16:34:04 +03:00
Marko Mäkelä
1f498f901b 5.6.44-86.0 2019-07-23 15:47:22 +03:00
Marko Mäkelä
d653db32f2 MDEV-14154: Make ut_time_ms(), ut_time_us() monotonic
This is motivated by PS-5221 in
percona/percona-server@2817c561fc

The coarser-precision ut_time() will still refer to the
system clock, meaning that bad things can happen if the
real time clock is adjusted backwards.
2019-07-23 15:23:27 +03:00
Laurynas Biveinis
c385d80abd Fix PS-5388 (Enable hardware CRC32 under Valgrind)
Valgrind started supporting CRC32 instruction starting with version
3.6.1, released in 2011. Thus remove the fallback to software
implementation in case running under Valgrind.
2019-07-23 15:23:27 +03:00
Marko Mäkelä
61b5e244d6 MDEV-20127 Merge new release of InnoDB 5.6.45 to 10.1
There is one directly applicable change to InnoDB:
commit 739f5239f1 in the
5.5 branch will be merged before the next MariaDB releases.

Another potentially applicable change will be tracked
separately as MDEV-20126.

Thus, here we only update the InnoDB version number and do
not change anything else.
2019-07-23 15:23:27 +03:00
Marko Mäkelä
e6c1e588f0 gen_lex_hash: Omit deprecated register keywords
This is follow-up to d36c107a6b
2019-07-23 15:23:27 +03:00
Marko Mäkelä
9d93f9dac4 MDEV-8827: Fix the 32-bit build
Follow-up to 07ba5560da:
Use the correct 64-bit type name ulonglong instead of ulint,
like in mysql/mysql-server@4e0100d86b
2019-07-23 15:00:53 +03:00
Rahul Malik
739f5239f1 Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS
Problem: Clients running different values for auto_increment_increment
and doing concurrent inserts leads to "Duplicate key error" in one of them.

Analysis:
When auto_increment_increment value is reduced in a session,
InnoDB uses last auto_increment_increment value
to recalculate the autoinc value.
In case, some other session has inserted a value
with different auto_increment_increment, InnoDB recalculate
autoinc values based on current session previous auto_increment_increment
instead of considering the auto_increment_increment used for last insert
across all session

Fix:
revert 7acdf29cb4
a.k.a. 7c12a9e5c3
as it causing the bug.

Reviewed By:
Bin <bin.x.su@oracle.com>
Kevin <kevin.lewis@oracle.com>
RB#21777

Note: In MariaDB Server, earlier changes in
ae5bc05988
for MDEV-533 require that the original test in
mysql/mysql-server@1ccd472d63
be adjusted for MariaDB.

Also, ef47b62551 (MDEV-8827)
had to be reverted after the upstream fix had been backported.
2019-07-23 11:26:11 +03:00
Marko Mäkelä
7153e15542 Revert "MDEV-8827 Duplicate key with auto increment"
This reverts commit ef47b62551.
The parent commit 07ba5560da
which is a backport of
mysql/mysql-server@1198267c33
fixes the issue differently.
2019-07-23 11:01:44 +03:00
Thirunarayanan Balathandayuthapani
07ba5560da Bug #20989615 INNODB AUTO_INCREMENT PRODUCES SAME VALUE TWICE
Problem:
=======
Autoincrement value gives duplicate values because of the following reasons.

(1) In InnoDB handler function, current autoincrement value is not changed
based on newly set auto_increment_increment or auto_increment_offset variable.

(2) Handler function does the rounding logic and changes the current
autoincrement value and InnoDB doesn't aware of the change in current
autoincrement value.

Solution:
========
Fix the problem(1), InnoDB always respect the auto_increment_increment
and auto_increment_offset value in case of current autoincrement value.
By fixing the problem (2), handler layer won't change any current
autoincrement value.

Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>
RB: 13748
2019-07-23 10:58:56 +03:00
Marko Mäkelä
70b226d966 Merge 10.2 into 10.3 2019-07-22 17:37:04 +03:00
Marko Mäkelä
3bcda8ad5f MDEV-17005: Re-enable existing tests for non-debug server 2019-07-22 17:33:08 +03:00
Alexey Yurchenko
819c40d694 - wsrep-lib update (SR cleanups and voting support) (#1359)
- TOI error ignoring fix (wsrep_ignore_apply_errors)
2019-07-22 16:34:12 +03:00
Marko Mäkelä
60c790d6f4 Merge 10.1 into 10.2 2019-07-22 15:28:05 +03:00