Commit graph

190416 commits

Author SHA1 Message Date
Nikita Malyavin
fd0abc890f MDEV-18042 Server crashes upon adding a non-null date column under NO_ZERO_DATE with ALGORITHM=INPLACE
accept table_name and db_name instead of table_share in make_truncated_value_warning
2020-07-31 17:38:41 +10:00
Nikita Malyavin
91ebf1844f MDEV-19338 InnoDB: Failing assertion: !cursor->index->is_committed()
Call mark_columns_per_binlog_row_image before find_row() to set up table->vcol_set early,
so the virtual column value will be updated after record read (ha_rnd_pos/ha_index_next/etc)
by table->update_virtual_fields() call
2020-07-31 17:32:29 +10:00
Sergei Golubchik
153cd6a27f MDEV-23237 mariadb.sys has too many privileges
don't GRANT UPDATE ON mysql.global_priv TO mariadb.sys@localhost;
2020-07-31 09:00:05 +02:00
Sergei Golubchik
78f09b12d3 MDEV-23009 SIGSEGV in get_field from acl_load (on optimized builds)
Classes that handle privilege tables (like Tables_priv_table)
could read some columns conditionally but they expect a certain
minimal number of colunms always to exist.

Add a check for a minimal required number of columns in privilege tables,
don't use a table that has fewer columns than required.
2020-07-31 09:00:05 +02:00
Alexander Barkov
a874b6c445 MDEV-23337 Rounding functions create a wrong data type for integer input
1. Fixing ROUND(x) and TRUNCATE(x,0) with TINYINT, SMALLINT, MEDIUMINT, BIGINT
   input to preserve the exact data type of the argument when it's possible.

2. Fixing FLOOR(x) and CEILING(x) with TINYINT, SMALLINT, MEDIUMINT, BIGINT
  to preserve the exact data type of the argument.

3. Adding dedicated Type_handler_year::Item_func_round_fix_length_and_dec()
  to easier handle ROUND(x) and TRUNCATE(x,y) for the YEAR(2) and YEAR(4)
  input. They still return INT(2) UNSIGNED and INT(4) UNSIGNED correspondingly,
  as before.
2020-07-31 07:41:30 +04:00
Sergei Golubchik
09ec8e2e22 improve the error message for a dropped current role 2020-07-30 23:50:56 +02:00
Sergei Golubchik
4635218cb0 MDEV-22521 Server crashes in traverse_role_graph_up or Assertion `user' fails in traverse_role_graph_impl 2020-07-30 23:50:56 +02:00
Marko Mäkelä
6053eb1ce2 MDEV-23334 Crash in rec_get_nth_cfield()/rec_offs_validate()
rec_get_nth_cfield(): Remove a bogus debug assertion.
The function may be invoked by innobase_rec_to_mysql()
for reporting a duplicate key error during CREATE UNIQUE INDEX
or ALTER TABLE...ADD UNIQUE KEY, and in that case the record
will be missing the 5-byte or 6-byte fixed header.

It turns out that in every other code path leading to
rec_get_nth_cfield() we either invoked rec_get_offsets()
ourselves or asserted rec_offs_validate(). So, we can
safely remove the assertion and make debug builds
smaller and faster.
2020-07-30 18:40:47 +03:00
Krunal Bauskar
c69520c9df MDEV-23030: ARM crash on Raspberry Pi 4
MariaDB adopted a hardware optimized crc32c approach on ARM64 starting 10.5.
Said implementation of crc32c needs support from target hardware for crc32
and pmull instructions. Existing logic is checking only for crc32 support
from target hardware through a runtime check and so if target hardware
doesn't support pmull it would cause things to fail/crash.

Expanded runtime check to ensure pmull support is also checked on the target
hardware along with existing crc32.

Thanks to Marko and Daniel for review.
2020-07-30 15:44:54 +03:00
Jan Lindström
c3958ae407 Enable test for testing. 2020-07-30 14:15:26 +03:00
Vladislav Vaintroub
0435fcf90b MDEV-21101 skip test for embedded 2020-07-30 12:08:07 +02:00
Thirunarayanan Balathandayuthapani
8a612314d0 MDEV-23332 Index online status assert failure in btr_search_drop_page_hash_index
Problem:
========
In row_merge_drop_indexes(), InnoDB drops only the index from
dictionary and frees the index pages but it maintains the index
object if the table is being used by other DML threads. It sets
the online status of the index to ONLINE_INDEX_ABORTED_DROPPED.
Removing the index from dictionary doesn't remove the
corressponding ahi entries of the index. When block is being
reused, InnoDB tries to remove ahi entries for the block and
it fails if index online status is ONLINE_INDEX_ABORTED_DROPPED.

Fix:
====
MDEV-22456 allows the index ahi entries to be dropped lazily.
so checking online status in btr_search_drop_page_hash_index()
is meaningless and should be removed.
2020-07-30 13:59:03 +05:30
Vladislav Vaintroub
71015d844e MDEV-21101 unexpected wait_timeout with pool-of-threads
Due to restricted size of the threadpool, execution of client queries can
be delayed (queued) for a while. This delay was interpreted as client
inactivity, and connection is closed, if client idle time + queue time
exceeds wait_timeout.

But users did not expect queue time to be included into wait_timeout.

This patch changes the behavior. We don't close connection anymore,
if there is some unread data present on connection,
even if wait_timeout is exceeded. Unread data means that client
was not idle, it sent a query, which we did not have time to process yet.
2020-07-30 10:17:45 +02:00
Marko Mäkelä
4860fe244b XtraDB 5.6.49-89.0
The only change between Percona XtraDB Server 5.6.48-88.0
and 5.6.49-89.0 (apart from the version number change) was
percona/percona-server@25ec240920
which we had already addressed in
commit 7c03edf2fe and
commit c0fca2863b.
2020-07-30 11:06:46 +03:00
Marko Mäkelä
c5d4dd2533 MDEV-23339 innodb_force_recovery=2 may still abort the rollback of recovered transactions
trx_rollback_active(), trx_rollback_resurrected(): Replace
an incorrect condition that we failed to replace in
commit b68f1d847f (MDEV-21217).
2020-07-30 09:24:36 +03:00
Alexander Barkov
6d3186e326 MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
Implementing dedicated fixing methods:
- Type_handler_bit::Item_func_round_fix_length_and_dec()
- Type_handler_bit::Item_func_int_val_fix_length_and_dec()
- Type_handler_typelib::Item_func_round_fix_length_and_dec()

because the inherited methods did not work well.

Fixing:
- Type_handler_typelib::Item_func_int_val_fix_length_and_dec
  It did not work well, because it used args[0]->max_length to
  calculate the result data type. In case of ENUM and SET it was
  not correct, because in FLOOR() and CEILING() context
  ENUM and SET return not more than 5 digits (65535 is the biggest
  possible value).

Misc:
- Changing the API of
    Type_handler_bit::Bit_decimal_notation_int_digits(const Item *item)
  to a more generic form:
    Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits(uint nbits)

- Fixing Type_handler_bit::Bit_decimal_notation_int_digits_by_nbits() to
  return the exact number of decimal digits for all nbits 1..64.
  The old implementation was approximate.
  This change gives better (more precise) data types.
2020-07-30 08:04:58 +04:00
Otto Kekäläinen
f99de8915e Deb: Make RocksDB plugin depend on python3 as myrocks_hotbackup needs it
This fixes the Lintian error and thus the Lintian override can also be
removed.
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
a10f72aa5e Deb: Proper DH_ and DEB_ flag use in debian/rules
- DEB_BUILD_HARDENING is only used with hardening-wrapper which is
  deprecated in Debian, so remove it
- The word 'terse' should be checked in DEB_BUILD_OPTIONS and verbosity
  controlled by it
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
497e7eda8c Deb: Stop suggesting tinyca, upstream project does not exist anymore
TinyCA has not been updated since 2016 and was removed from Debian in 2019
and the dev site https://tinyca.alioth.debian.org/ is offline.

See https://tracker.debian.org/pkg/tinyca
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
bdf8268307 Deb: Simplify and unify autobake-deb.sh
- Remove excess build flag from debian/rules that does nothing, introduced
  wrongly in commit 7cbde2d0a2. Instead
  implement the embedded server build skipping on Travis-CI correctly.
- Simplify structure by doing all Travis-CI slimdown in one step.
- Remove unnecessary -e from sed, as it does nothing. When regex is needed,
  use -r. Move -i to last so it is close to the file name it has an
  argument.
- Remove backwards compat checks that are no longer relevant as neither
  Debian Jessie (was before Stretch) nor Ubuntu Trusty (before Xenial)
  are supported nor built for anymore. For example the GCC 4.8 check
  if not relevant anymore, since Debian Jessie already has 4.9 and
  Ubuntu Xenial has 5.3 and there is no GCC < 4.8 around anymore.
- Skip building ColumnStore on both Travis-CI and Gitlab-CI as it is
  way too slow (time) and big (disk space) to pass.
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
7a0fa9da03 Deb: Cleanup and document
- Remove unnecessary unused files
- Remove duplicate encryption configuration sample from sources and
  re-use the identical file in RPM directory instead
- Clean away harmful "default-character-set = utf8mb4" from client config
  as it is unnecassary (server enforces utf8mb4 anyway by default) and
  could cause issues with mysqlbinlog and other tools (MDEV-22981).
- Update S3 plugin description to be long enough
- Remove trailing whitespace from support-files and Debian packaging.
- Clean away fixed Lintian issues
- Clean away temporary Salsa-CI fixes now that 10.5.4 is out and is fixed
- Apply wrap-and-sort -a -v
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
7c1807a0ad Deb: On upgrades, stop both mysqld and mariadbd for backwards compat 2020-07-30 10:36:39 +10:00
Otto Kekäläinen
b8031e362a Use mktemp instead of deprecated tempfile
This fixes the warning emitted during `/etc/init.d/mariadb restart`:
  WARNING: tempfile is deprecated; consider using mktemp instead.
2020-07-30 10:36:39 +10:00
Otto Kekäläinen
ab48901d54 Fix spelling errors 2020-07-30 10:36:39 +10:00
Sergei Petrunia
7e9ffc69ec MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows
Do not collect EITS statistics for this statement:

  ALTER TABLE t ANALYZE PARTITION p

EITS stats are currently global, not per-partition.
Collecting global stats when we are asked to process just one partition
causes issues for DBAs.
2020-07-29 23:27:40 +03:00
Alexander Barkov
92499ae95c MDEV-23320 Hex hybrid constants 0xHHHH work badly in rounding functions
- Type_handler_hex_hybrid did not override
  Type_handler_string_result::Item_func_round_fix_length_and_dec(),
  so the result type of ROUND(0xFFFFFFFFFFFFFFFF) was erroneously
  calculated ad DOUBLE with a wrong length.
  Overriding Item_func_round_fix_length_and_dec(), to calculated
  the result type as INT/BIGINT.

  Also, fixing Item_func_round::fix_arg_int() to use
  args[0]->decimal_precision() instead of args[0]->max_length
  when calculating this->max_length, to get a correct result
  for hex hybrids.

- Type_handler_hex_hybrid::Item_func_int_val_fix_length_and_dec()
  called item->fix_length_and_dec_int_or_decimal(), which did not
  produce a correct result data type for hex hybrid.
  Implementing a dedicated code instead, to return INT UNSIGNED or
  BIGINT UNSIGNED depending in the number of digits in the arguments.
2020-07-29 21:45:41 +04:00
Sergei Golubchik
e54a7ac1b3 MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user
check both column- and table-level grants when looking for SELECT
privilege on UPDATE statement.
2020-07-29 14:56:24 +02:00
Sergei Golubchik
2ba70f69fd cleanup: reduce code duplication 2020-07-29 14:56:24 +02:00
Sergei Golubchik
0b5b2f8641 Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE WITH A COMPOSITE PREFIX INDEX
Fix prefix key comparison in partitioning. Comparions must
take into account no more than prefix_len characters.

It used to compare prefix_len*mbmaxlen bytes.
2020-07-29 14:56:24 +02:00
Sergei Golubchik
d5970779fa bugfix: mysql_create_view() infinite loop
if mysql_create_view() is aborted when view is linked into lex
(when WSREP_TO_ISOLATION_BEGIN fails),
it should not be linked there again on err:.
2020-07-29 14:56:24 +02:00
Sergei Golubchik
77b7f793f9 MDEV-18496 Crash when Aria encryption is enabled but plugin not available
fix uninitialized struct member
2020-07-29 14:56:24 +02:00
Sergei Golubchik
88cbe2f081 MDEV-18496 Crash when Aria encryption is enabled but plugin not available
wait_while_table_is_used() should return an error if handler::extra() fails
2020-07-29 14:56:24 +02:00
Oleksandr Byelkin
2107e3bb9c MDEV-21258: Can't uninstall plugin if the library file doesn't exist
Removing plugin from the mysql.plugin even if the plugin is not loaded
2020-07-29 12:34:53 +02:00
Eugene Kosov
8ec877f40a speed up my_timer_init()
I run perf top during ./mtr testing and constantly see times()
function there. It's so slow, that it has no sense to run it
in a loop too many times.

This patch speeds up -suite=innodb for me from 218s to 208s.
9s of times() function!
2020-07-29 08:21:32 +03:00
Nikita Malyavin
34f2be3b29 MDEV-16023 Unfortunate error message WARN_VERS_PART_FULL (partition <name> is full) when rotation time for the last interval passed
* remove one case of WARN_VERS_PART_FULL
2020-07-29 14:32:07 +10:00
Eugene Kosov
423de1e574 MDEV-23245 MDEV-22898 Still getting assertion failure in file data0type.cc line 67
Doesn't allow instant alter of a field which is a prefix part of some key

is_part_of_a_key_prefix(): I hope the name of the function is clear

ha_innobase::can_convert_string()
ha_innobase::can_convert_varstring()
ha_innobase::can_convert_blob(): it can't when field is_part_of_a_key_prefix()
2020-07-29 06:12:31 +03:00
Alexander Barkov
5b3b53ce36 MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE()
Fixing functions CEILING and FLOOR to return
- TIME for TIME input
- DATETIME for DATETIME and TIMESTAMP input
2020-07-28 23:29:08 +04:00
Jan Lindström
69cf6302f3 galera_var_notify_cmd still hangs. 2020-07-28 14:23:57 +03:00
Marko Mäkelä
05fa4558e0 MDEV-22110 InnoDB unnecessarily writes unmodified pages
At least since commit 6a7be48b1b
InnoDB appears to be invoking buf_flush_note_modification() on pages
that were exclusively latched but not modified in a mini-transaction.

MTR_MEMO_MODIFY, mtr_t::modify(): Define not only in debug code,
but also in release code. We will set the MTR_MEMO_MODIFY flag
on the earliest mtr_t::m_memo entry that we find.

MTR_LOG_NONE: Only use this mode in cases where the previous
mode will be restored before anything is modified in the mini-transaction.

MTR_MEMO_PAGE_X_MODIFY, MTR_MEMO_PAGE_SX_MODIFY: The allowed flag
combinations that include MTR_MEMO_MODIFY.

ReleaseBlocks: Only invoke buf_flush_note_modification()
on those buffer pool blocks on which mtr_t::set_modified()
and mtr_t::modify() were invoked.
2020-07-28 14:02:11 +03:00
Marko Mäkelä
cf3c3cce1d MDEV-23304 Insert into TEMPORARY TABLE fails to invoke mtr_t::set_modified()
In MDEV-21724 or possibly already in MDEV-12353 a bug was introduced to
the handling of temporary tables.

Whether or not redo log will be written, mtr_t::set_modified()
must be invoked to register any changes to a page.

page_cur_insert_rec_low(): Invoke mtr_t::set_modified() also
when skipping the redo log write.
2020-07-28 14:02:11 +03:00
Marko Mäkelä
3c3f172f17 MDEV-23308 CHECK TABLE attempts to access parent_right_page_no=FIL_NULL
mysql/mysql-server@e00ad49edc
which introduced WL#6326 to MySQL 5.7.2 added a buffer page
acquisition to CHECK TABLE code (solely for the purpose of
obeying the changed latching order), but failed to check that
a parent page actually exists. It would not necessarily exist in a
corrupted index where a parent page is missing pointer records
to child pages.
2020-07-28 13:00:59 +03:00
Marko Mäkelä
6307b17aa1 MDEV-20142 encryption.innodb_encrypt_temporary_tables failed in buildbot with wrong result
Let us read both encrypted temporary tables to increase the changes of
page flushing and eviction.
2020-07-28 13:00:59 +03:00
Daniel Black
940668f5cb MDEV-23137: aarch64, postfix - cmake include 2020-07-28 19:53:19 +10:00
Roman Nozdrin
2c5831b2c5 MCOL-4166 The solution to the minor upgrade issue
DEB package doesn't need expect and libreadline as dependencies

RPM packages now depends on jemalloc again
2020-07-28 09:48:17 +00:00
Daniel Black
6a70398c7a MDEV-23176: s3 curl library path fix
On FreeBSD (and possibly elsewhere) the FindPackage(curl)
may have found the curl library in a non-standard directory.

We use the exposed path as a library path to correct linking.
2020-07-28 10:08:14 +03:00
Oleksandr Byelkin
e08f87d527 fix obvious bugs hidden by current_select assigned to builtin select 2020-07-28 08:23:57 +02:00
Oleksandr Byelkin
c6eb21cd87 MDEV-21998: Server crashes in st_select_lex::add_table_to_list upon mix of KILL and sequences
Continue support the hack of current select equal builtin select if
selects stack is empty even after subselects.
2020-07-28 08:23:57 +02:00
Dan Solodko
459b87f6b4 MDEV-9911: NTILE must return an error when parameter is not stable 2020-07-28 06:35:32 +02:00
Daniel Black
3cb9131ac2 MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrs
Small postfix to MDEV-23175 to ensure faster option on FreeBSD
and compatibility to Solaris that isn't high resolution.

ftime is left as a backup in case an implementation doesn't
contain any of these clocks.

FreeBSD
    $ ./unittest/mysys/my_rdtsc-t
    1..11
    # ----- Routine ---------------
    # myt.cycles.routine          :             5
    # myt.nanoseconds.routine     :            11
    # myt.microseconds.routine    :            13
    # myt.milliseconds.routine    :            11
    # myt.ticks.routine           :            17
    # ----- Frequency -------------
    # myt.cycles.frequency        :    3610295566
    # myt.nanoseconds.frequency   :    1000000000
    # myt.microseconds.frequency  :       1000000
    # myt.milliseconds.frequency  :           899
    # myt.ticks.frequency         :           136
    # ----- Resolution ------------
    # myt.cycles.resolution       :             1
    # myt.nanoseconds.resolution  :             1
    # myt.microseconds.resolution :             1
    # myt.milliseconds.resolution :             7
    # myt.ticks.resolution        :             1
    # ----- Overhead --------------
    # myt.cycles.overhead         :            26
    # myt.nanoseconds.overhead    :         19140
    # myt.microseconds.overhead   :         19036
    # myt.milliseconds.overhead   :           578
    # myt.ticks.overhead          :         21544
    ok 1 - my_timer_init() did not crash
    ok 2 - The cycle timer is strictly increasing
    ok 3 - The cycle timer is implemented
    ok 4 - The nanosecond timer is increasing
    ok 5 - The nanosecond timer is implemented
    ok 6 - The microsecond timer is increasing
    ok 7 - The microsecond timer is implemented
    ok 8 - The millisecond timer is increasing
    ok 9 - The millisecond timer is implemented
    ok 10 - The tick timer is increasing
    ok 11 - The tick timer is implemented
2020-07-28 12:44:26 +10:00
Karthik Kamath
e6cb263ef3 MDEV-15961: Fix stacktraces under FreeBSD (aarch64)
Largely based on MySQL commit
75271e51d6

MySQL Ref:
    BUG#24566529: BACKPORT BUG#23575445 TO 5.6

    (cut)
    Also, the PTR_SANE macro which tries to check if a pointer
    is invalid (used when printing pointer values in stack traces)
    gave false negatives on OSX/FreeBSD. On these platforms we
    now simply check if the pointer is non-null. This also removes
    a sbrk() deprecation warning when building on OS X. (It was
    before only disabled with building using XCode).

Removed execinfo path of MySQL patch that was already included.

sbrk doesn't exist on FreeBSD aarch64.

Removed HAVE_BSS_START based detection and replaced with __linux__
as it doesn't exist on OSX, Solaris or Windows.  __bss_start
exists on mutiple Linux architectures.

Tested on FreeBSD and Linux x86_64. Being in FreeBSD ports for 2
years implies a good testing there on all FreeBSD architectures there
too. MySQL-8.0.21 code is functionally identical to original commit.
2020-07-28 11:10:25 +10:00