Commit graph

187561 commits

Author SHA1 Message Date
Alexander Barkov
6afb2a37fd MDEV-20768 Turn INET functions into a function collection plugin 2019-10-07 23:17:21 +04:00
Alexander Barkov
e0117f1120 A cleanup for: MDEV-18010 Add classes Inet4 and Inet6
- Moving the implementations of class Inet4 and class Inet6 into separate
  files sql_type_inet.h and sql_type_inet.cc, in order to reuse them
  for the INET6 data type and inet function collection.
- Adding a warning in the case when IS_IPV4_MAPPED() and IS_IPV4_COMPAT()
  erroneously gets an IPv4 address instead of the expected IPv6 address.
2019-10-07 21:00:42 +04:00
Marko Mäkelä
db9a4d928d Remove orphan declaration buf_flush_wait_batch_end_wait_only()
The function was declared but not defined in
commit 9d6d1902e0
2019-10-07 17:18:10 +03:00
Sergey Vojtovich
adefaeffcc MDEV-19536 - Server crash or ASAN heap-use-after-free in is_temporary_table /
read_statistics_for_tables_if_needed

Regression after 279a907, read_statistics_for_tables_if_needed() was
called after open_normal_and_derived_tables() failure.

Fixed by moving read_statistics_for_tables() call to a branch of
get_schema_stat_record() where result of open_normal_and_derived_tables()
is checked.

Removed THD::force_read_stats, added read_statistics_for_tables() instead.
Simplified away statistics_for_command_is_needed().
2019-10-07 13:30:22 +04:00
Alexander Barkov
cbf6beba40 MDEV-20764 Add MariaDB_FUNCTION_COLLECTION_PLUGIN 2019-10-07 11:31:32 +04:00
Jan Lindström
c339487030 Try to fix galera_parallel_simple test case. 2019-10-07 08:47:42 +03:00
Alexander Barkov
3616175fdd MDEV-20760 Add Type_handler::KEY_pack_flags() 2019-10-05 18:16:37 +04:00
Alexander Barkov
c717483c9d MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN 2019-10-04 22:14:44 +04:00
Sergei Petrunia
37570e845b MDEV-20740: Odd computations in calculate_cond_selectivity_for_table
Make SEL_ARG graph traversal code in sel_arg_range_seq_next() set
max_key_parts first.

(Pushing to 10.4 first)
2019-10-04 20:18:31 +03:00
Sergei Golubchik
a5c34bc200 if the test uses example plugin, it has to check whether plugin exists 2019-10-04 15:58:47 +02:00
Sergei Golubchik
b710d01dc7 mark PAMv2 plugin stable 2019-10-04 15:58:47 +02:00
Jan Lindström
fe4f766e81 Add wait_condition to wait that node returns to ready state before
accessing it.
2019-10-04 14:45:25 +03:00
Oleksandr Byelkin
13535b2713 Fix problem with warnings of new compilers. 2019-10-04 11:03:54 +02:00
Marko Mäkelä
627027a674 Merge 10.4 into 10.5 2019-10-04 10:56:47 +03:00
Marko Mäkelä
1950e32464 MDEV-20706: Add missing override qualifiers 2019-10-04 10:56:43 +03:00
Marko Mäkelä
5709a7777b MDEV-19956: Do not dereference an uninitialized pointer
LEX::parsed_select_expr_cont(): Replace a condition with an
assertion DBUG_ASSERT(!s2->next_select()), and always
initialize sel1=s2, because all subsequent code paths will
assign to sel1->first_nested.

This was flagged by GCC reporting -Wmaybe-uninitialized
for the statement last->link_neighbour(sel1).
2019-10-04 10:27:55 +03:00
Alexander Barkov
57ce0bab32 A cleanup for MDEV-19908 Add class Type_collection
Moving geometry types aggregation inside Type_collection_geometry

This change introduces a static method Type_aggregator::find_handler_in_array(),
which will later be reused by other data type plugins.
2019-10-04 10:12:27 +04:00
Eugene Kosov
5e65c67cfc fix clang warning 2019-10-03 17:45:36 +03:00
Alexander Barkov
c2d8db66be MDEV-20735 Allow non-reserved keywords as user defined type names 2019-10-03 16:03:32 +04:00
Alexander Barkov
d168601e83 MDEV-20734 Allow reserved keywords as user defined type names 2019-10-03 14:02:00 +04:00
Alexander Barkov
54606df1a3 A cleanup for MDEV-19908 Add class Type_collection
If we have a mixture of:
- a MariaDB standard (built-in permanent) data type, and
- a non-standard (optionally compiled or pluggable) data type,
then ask the type collection of the non-standard type to aggregate the mixture.

If the non-standard collection fails, then continue aggregation
with Type_handler_data.
2019-10-03 10:29:44 +04:00
Jan Lindström
eb0a10b072 Add missing have_debug to galera.MDEV-20225 test case. 2019-10-03 07:03:15 +03:00
Sergey Vojtovich
5b2fa078e8 Cleanup mman.h includes
As it is included from my_global.h already.
2019-10-02 20:21:30 +04:00
Daniel Black
716c748f97 MDEV-20684: innodb/query cache use madvise CORE/NOCORE on FreeBSD
This applies to large allocations.

This maps to the way Linux does it in MDEV-10814 except FreeBSD uses
different constants.

Adjust error string to match to implementation.

Tested on FreeBSD-12.0
2019-10-02 20:00:05 +04:00
Alexander Barkov
cefe5bb6b3 A cleanup for MDEV-20042 Implement EXTRA2_FIELD_DATA_TYPE_INFO in FRM
Adding error reporting (ER_UNKNOWN_DATA_TYPE) when a handler name read
from EXTRA2_FIELD_DATA_TYPE_INFO is not known to the server.
2019-10-02 18:10:58 +04:00
Sergey Vojtovich
e43791d4dc Cleanup EITS
Moved EITS allocation inside read_statistics_for_tables_if_needed().
Removed redundant is_safe argument.
2019-10-02 15:23:59 +04:00
Alexander Barkov
5e356ce707 MDEV-20721 Implement sql_type() for Field_real and Field_int 2019-10-02 11:11:12 +04:00
Alexander Barkov
9c031fc218 MDEV-20716 Unify make_table_field() and make_table_field_from_def() for integer and real types 2019-10-01 23:41:03 +04:00
Alexander Barkov
4b5a76741e MDEV-20712 Wrong data type for CAST(@a AS BINARY) for a numeric variable 2019-10-01 22:30:28 +04:00
Alexander Barkov
c06397f615 Fixing a Windows compilation failure introduced by MDEV-20706 2019-10-01 17:10:41 +04:00
Alexander Barkov
7474deec49 MDEV-20708 Change make_table_field() to get TABLE_SHARE rather than TABLE 2019-10-01 17:04:22 +04:00
Vlad Lesin
edda2fd149 MDEV-20703: mariabackup creates binlog files in server binlog directory on --prepare --export step
When "--export" mariabackup option is used, mariabackup starts the server in
bootstrap mode to generate *.cfg files for the certain innodb tables.
The started instance of the server reads options from the file, pointed
out in "--defaults-file" mariabackup option.

If the server uses the same config file as mariabackup, and binlog is
switched on in that config file, then "mariabackup --prepare --export"
will create binary log files in the server's binary log directory, what
can cause issues.

The fix is to add "--skip-log-bin" in mysld options when the server is
started to generate *.cfg files.
2019-10-01 13:57:24 +03:00
Jan Lindström
97d82c3429 galera_sp_bf_abort requires debug Galera library. 2019-10-01 12:40:29 +03:00
Alexander Barkov
02dea3ffd5 MDEV-20706 Store scale in Column_definition::decimals rather than Column_definition::pack_flag 2019-10-01 13:12:46 +04:00
Alexander Barkov
1ae09ec863 Merge remote-tracking branch 'origin/10.4' into 10.5 2019-10-01 11:44:27 +04:00
seppo
c42c4233cb MDEV-20225 BF aborting SP execution (#1394)
* MDEV-20225 BF aborting SP execution

When stored procedure execution was chosen as victim for a BF abort, the old implemnetationn called for rollback immediately
when execution was inside SP isntruction. Technically this happened in wsrep_after_statement() call, which identified the
need for a rollback.
The problem was that MariaDB does not accept rollback (nor commit) inside sub statement, there are several asserts about it,
checking for THD::in_sub_stmt.

This patch contains a fix, which skips calling wsrep_after_statement() for SP execution, which is marked as BF must abort. Instead,
we return error code to upper level, where rollback will eventually happen, ouside of SP execution.
Also, appending the affected trigger table (dropped or created) in the populated key set for the write set,
which prevents parallel applying of other transactions working on the same table.

* MDEV-20225 BF aborting SP execution, second patch

First PR missed 4 commits, which are now squashed in this patch:
- Added galera_sp_bf_abort test.
  A MTR test case which will reproduce BF-BF conflict if all keys
  corresponding to affected tables are not assigned for DROP TRIGGER.
- Fixed incorrect use of sync pointsin MDEV-20225
- Added condition for SQLCOM_DROP_TRIGGER in wsrep_can_run_in_toi()
  to make it replicate.

* MDEV-20225 BF aborting SP execution, third patch

The galera_trigger.test caused a situation, where SP invocation caused a trigger
to fire, and the trigger executed as sub statement SP, and was BF aborted by applier.
because of wsrep_after_statement() was called for the sub-statement level, it ended up
in exeuting rollback and asserted there.
Thus fix will catch sub-statement level SP execution, and avoids calling wsrep_after_statement()
2019-10-01 10:41:33 +03:00
Alexander Barkov
dc588e3d3f Merge remote-tracking branch 'origin/10.3' into 10.4 2019-10-01 10:45:52 +04:00
Alexander Barkov
7e44c455f4 Merge remote-tracking branch 'origin/10.2' into 10.3 2019-10-01 09:37:40 +04:00
Alexander Barkov
f203245e9e Merge remote-tracking branch 'origin/10.1' into 10.2 2019-10-01 07:11:54 +04:00
Alexander Barkov
4bcf524482 Merge remote-tracking branch 'origin/5.5' into 10.1 2019-10-01 06:07:56 +04:00
Alexander Barkov
d481f69a7d MDEV-20704 An index on a double column erroneously uses prefix compression 2019-10-01 05:55:14 +04:00
Robert Bindar
576a5f091e MDEV-20647 Fix and enable SphinxSE tests 2019-09-30 15:47:09 +03:00
Aleksey Midenkov
4cd79588de SQL: override qualifier for Type_handler_int_result
Fixes -Winconsistent-missing-override in
MDEV-16144 Default TIMESTAMP clause for SELECT from versioned
2019-09-30 15:30:26 +03:00
Alexey Botchkov
6c2724fc05 MDEV-19628 JSON with starting double quotes key is not valid.
Make the skip_key a bit faster.
2019-09-30 15:27:48 +04:00
Aleksey Midenkov
19b5b17773 SQL: followup misc rename on versioning
vers_sys_type_t -> vers_kind_t
2019-09-30 14:05:09 +03:00
Aleksey Midenkov
58fdf5b2fa MDEV-16144 Default TIMESTAMP clause for SELECT from versioned
1. Removed TIMESTAMP/TRANSACTION unit auto-detection in favor of default TIMESTAMP.

Reasons:

1.1. rare practical use and doubtful advantage of such auto-detection;
1.2. it conflicts with MDEV-16226 (TRX_ID-based versioned tables performance improvement).

Needless check_unit membership removed.

2. SQL: versioning type handling refactoring

Vers_type_handler hierarchy stores versioning properties of type.

virtual Type_handler::vers() accesses specialization of
Vers_type_handler for specific type.

virtual Vers_type_handler::kind() returns versioning kind
(timestamp/trx_id).

Removed Type_handler::Vers_history_point_check_unit() in favor of
Type_handler::vers().

Renames:

require_timestamp() -> require_timestamp_error()
require_trx_id() -> require_trx_id_error()

EDIT by Alexander Barkov (@abarkov):

check_sys_fields() moved to Vers_type_handler::check_sys_fields()
2019-09-30 14:05:09 +03:00
Alexey Botchkov
6ac2a35553 MDEV-19628 JSON with starting double quotes key is not valid.
First character of the key name is just skipped, so the escapement
wasn't handled properly.
2019-09-30 14:43:32 +04:00
Marko Mäkelä
46b785262b Fix -Wunused for CMAKE_BUILD_TYPE=RelWithDebInfo
For release builds, do not declare unused variables.

unpack_row(): Omit a debug-only variable from WSREP diagnostic message.

create_wsrep_THD(): Fix -Wmaybe-uninitialized for the PSI_thread_key.
2019-09-30 12:49:53 +03:00
Sujatha
9b80f9300d MDEV-20645: Replication consistency is broken as workers miss the error notification from an earlier failed group.
Analysis:
========
In general if there are three groups.
1 - Inserts 32 which fails due to local entry '32' on slave.
2 - Inserts 33
3 - Inserts 34

Each group considers itself as a waiter and it waits for prior group 'waitee'.
This is done in 'register_wait_for_prior_event_group_commit'. If there is no
other parallel group being scheduled then no waitee will be there.

Let us assume 3 groups are being scheduled in parallel.

3-> waits for 2-> waits for->1

'1' upon completion it checks is there any registered subsequent waiter. If
so it wakes up the subsequent waiter with its execution status. This execution
status is stored in wakeup_error.

If '1' failed then it sends corresponding wakeup_error to 2. Then '2' aborts
and it propagates error to '3'.  So all further commits are aborted.  This
mechanism works only when all transactions reach a stage where they are
waiting for their prior commit to complete.

In case of optimistic following scenario occurs.

1,2,3 are scheduled in parallel.

3 - Reaches group_commit_code waits for 2 to complete.
1 - errors out sets stop_on_error_sub_id=1.

When a group execution results in error its corresponding sub_id is set to
'stop_on_error_sub_id'. Any new groups queued for execution will check if
their sub_id is > stop_on_error_sub_id.  If it is true their execution will be
skipped as prior group execution failed.  'skip_event_group=1' will be set.
Since the execution of SQL thread is about to stop we just skip execution of
all the following event groups.  We still do all the normal waiting and wakeup
processing between the event groups as a simple way to ensure that everything
is stopped and cleaned up correctly.

Upon error '1' transaction checks for registered waiters. Since no one is
there it simply goes away.

2 - Starts the execution. It checks do I have a waitee.

Since wait_commit_sub_id == entry->last_committed_sub_id no waitee is set.

Secondly: 'entry->stop_on_error_sub_id' is set by '1'st execution.  Now
'handle_parallel_thread' code checks if the current group 'sub_id' is greater
than the 'sub_id' set within 'stop_on_error_sub_id'.

Since the above is true 'skip_event_group=true' is set.  Simply call
'wait_for_prior_commit' to wakeup all waiters.  Group '2' didn't had any
waitee and its execution is skipped.  Hence its wakeup_error=0.It sends a
positive wakeup signal to '3'. Which commits. This results in a missed
transaction. i.e 33 is missed and 34 is committed.

Fix:
===
When a worker learns that an earlier transaction execution has failed, and it
should not proceed for further execution, it should mark its own execution
status as failed so that it alerts its followers to abort as well.
2019-09-30 13:22:37 +05:30
Alexander Barkov
f610529d23 MDEV-20696 Remove Column_definition::key_length 2019-09-29 22:10:42 +04:00