Commit graph

1062 commits

Author SHA1 Message Date
Sergei Golubchik
00c3a28820 cleanup: data type plugins
simplify type naming (less boilerplate code).
don't force a plugin to specify the name twice.
2019-10-31 11:19:39 +01:00
Sergei Golubchik
779978217c Data type plugins - minor fixes
typos, comments
2019-10-31 11:19:35 +01:00
Marko Mäkelä
2b710090aa Merge 10.4 into 10.5 2019-10-29 16:31:40 +02:00
Alexander Barkov
b62a846642 MDEV-20913 sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type
Adding the missing grammar.
2019-10-29 13:33:38 +04:00
Sergei Golubchik
dadc53ff0b MDEV-19882 pam v2: auth_pam_tool truncates passwords that are not null-terminated
Don't assume that passwords (and other conv replies) are zero-terminated.
If they are, though, strndup() down below will take care of that.
2019-10-28 19:45:43 +01:00
Marko Mäkelä
658289ca53 MDEV-20844: Add missing override qualifiers
clang warns if only some overridden member functions in a class
are tagged with the C++11 override keyword. Add the missing keywords.
2019-10-28 16:22:48 +02:00
Alexander Barkov
ec171a94a3 MDEV-20844 RBR from binary(16) to inet6 fails with error 171: The event was corrupt, leading to illegal data being read
This patch changes the way how INET6 is packed to the RBR binary log:
- from fixed length 16 bytes
- to BINARY(16) compatible variable length style
  with trailing 0x00 byte compression.

This is to make INET6 fully compatible with BINARY(16) in RBR binary logs,
so RBR replication works in this scenarios:

- Old master BINARY(16) -> New slave INET6
- New master INET6      -> Old slave BINARY(16)

A new class StringPack was added to share the code between
Field_string and Field_inet6.
2019-10-18 13:15:55 +04:00
Alexander Barkov
5a052ab6b1 Part1: MDEV-20837 Add MariaDB_FUNCTION_PLUGIN
- Defining MariaDB_FUNCTION_PLUGIN
- Changing the code in /plugins/type_inet/ and /plugins/type_test/
  to use MariaDB_FUNCTION_PLUGIN instead of MariaDB_FUNCTION_COLLECTION_PLUGIN.
- Changing maturity for the INET6 data type plugin from experimental to alpha.
2019-10-16 21:40:30 +04:00
Alexander Barkov
22b645ef52 MDEV-20831 Table partitioned by LIST/RANGE COLUMNS(inet6) can be created, but not inserted into
This clause in CREATE TABLE:

  PARTITION BY LIST COLUMNS (inet6column)
    (PARTITION p1 VALUES IN ('::'))

was erroneously written to frm file as:

  PARTITION BY LIST COLUMNS(inet6column)
    (PARTITION p1 VALUES IN (_binary 0x3A3A))

I.e. the text value '::' was converted to HEX representation
and prefixed with _binary.

A simple fix could write `_latin1 0x3A3A` instead of `_binary 0x3A3A`,
but in case of INET6 we don't need neither character set introducers,
nor HEX encoding, because text representation of INET6 values consist
of pure ASCII characters.

So this patch changes the above clause to be printed as:

  PARTITION BY LIST COLUMNS(inet6column)
    (PARTITION p1 VALUES IN ('::'))

Details:

The old code in check_part_field() was not friendly to pluggable data types.
Replacing this function to two new virtual methods in Type_handler:

  virtual bool partition_field_check(const LEX_CSTRING &field_name,
                                     Item *item_expr) const;

  virtual bool partition_field_append_value(String *str,
                                            Item *item_expr,
                                            CHARSET_INFO *field_cs,
                                            partition_value_print_mode_t mode)
                                            const;

so data type plugins can decide whether they need to use character set
introducer and/or hex encoding when printing partition values.
2019-10-15 15:30:18 +04:00
Alexander Barkov
8ec978142b MDEV-20822 INET6 crashes in combination with RBR extended metadata
The code erroneously assumed that only Field_str descendants can
store character set information. After adding Field_inet6, it's
not true anymore.

Also, after adding Field_inet6, storing field->charset() become not correct either:
- Field_inet6::charset() return &my_charset_latin1,
  because clients see INET6 as VARCHAR(39).
- Field_inet6::binlog_type_info().m_cs returns &my_charset_bin
  because storage engines see INET6 as BINARY(16).

We need to store &my_charset_bin to the binlog metadata,
so the slave sees INET6 as BINARY(16), like storage engines do,
to make the slave treat the replicated data as binary IPv6 address
representation (rather than text representation).

The correct character set that needs to be stored to the metadata
is already populated to binlog_type_info_array[i].m_cs. So the
fixed code version uses this value rather than field->charset().
2019-10-14 18:33:31 +04:00
Alexander Barkov
a11694b80d MDEV-20826 Wrong result of MIN(inet6) with GROUP BY
Type_handler_inet6::is_val_native_ready() was not overriden and
returned "false" by default, so Item_sum_min_max::update_field()
erroneously went through the min_max_update_str_field() rather than
min_max_update_native_field() execution path. As a result '8888::'
was compared to 'fff::' in string format (rather than INET6 binary format)
and gave "less" instead of "greater".

Adding the forgotten overriding method returning "true".
2019-10-14 18:26:25 +04:00
Alexander Barkov
5392726e3c MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
The patch for `MDEV-20795 CAST(inet6 AS BINARY) returns wrong result`
unintentionally changed what Item_char_typecast::type_handler()
returns. This broke UNIONs with the BINARY() function, as the Aria
engine started to get columns of unexpected data types.

Restoring previous behaviour, to return
  Type_handler::string_type_handler(max_length).

The prototype for Item_handed_func::return_type_handler() has changed
from:
  const Type_handler *return_type_handler() const
to:
  const Type_handler *return_type_handler(const Item_handled_func *) const
2019-10-14 08:21:08 +04:00
Alexander Barkov
9853026cec MDEV-20800 Server crashes in Field_inet6::store_warning upon updating table statistics
Suppress warnings when Field_inet6::store() is called from
read_statistics_for_table() and other optimizer related routines.

This patch does for Field_inet6 the same thing with what Monty's
patch previously did for other Field_xxx:

> commit 1bbe8c5e0f
> Author: Michael Widenius <monty@mariadb.org>
> Date:   Sun Sep 22 04:08:48 2019 +0300
>
>    Proper fix for disabling warnings in read_statistics_for_table().
>    MDEV-20589: Server still crashes in Field::set_warning_truncated_wrong_value

Alas, some meaningful warnings disappeared.
2019-10-13 23:07:48 +04:00
Alexander Barkov
2cb7047f69 Removing redundant --source include/have_innodb.inc from type_inet6_{memory|myisam}.test
These tests use only HEAP and MyISAM tables.
2019-10-13 22:01:46 +04:00
Alexander Barkov
93cf67fda8 Adding the "override" keyword to Item_char_typecast_func_handler_inet6_to_binary::type_handler_for_create_select()
Clang fails to compile without it.
2019-10-13 18:32:48 +04:00
Alexander Barkov
6860d6f8be Fixing a mysqld crash on Ubuntu-10.2 (Quantal) 2019-10-12 15:28:40 +04:00
Alexander Barkov
530f3f7cfc MDEV-20806 Federated does not work with INET6, returns NULL with warning ER_TRUNCATED_WRONG_VALUE 2019-10-12 07:25:53 +04:00
Alexander Barkov
a0d3a351b8 MDEV-20790 CSV table with INET6 can be created and inserted into, but cannot be read from 2019-10-11 22:51:01 +04:00
Alexander Barkov
5d6d28f274 MDEV-20798 Conversion from INET6 to other types performed without errors or warnings 2019-10-11 22:19:30 +04:00
Alexander Barkov
d8e599bb80 MDEV-20808 CAST from INET6 to FLOAT does not produce an error 2019-10-11 20:12:24 +04:00
Alexander Barkov
b5fae7f743 MDEV-20795 CAST(inet6 AS BINARY) returns wrong result 2019-10-11 14:50:11 +04:00
Marko Mäkelä
d04f2de80a Merge 10.4 into 10.5 2019-10-11 08:41:36 +03:00
Alexander Barkov
312ba3cc3d MDEV-20783 INET6 cannot be converted to BINARY(16) 2019-10-10 08:12:14 +04:00
Alexander Barkov
b37386d854 MDEV-20785 Converting INET6 to CHAR(39) produces garbage without a warning 2019-10-09 22:25:58 +04:00
Alexander Barkov
c78ae293b4 Adding missing "override" keywords, to make clang happy. 2019-10-09 13:39:27 +04:00
Alexander Barkov
6ea5c2b5b6 MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB 2019-10-08 23:42:02 +04:00
Alexander Barkov
a07be05302 Fixing --ps test failures in "MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN" 2019-10-08 08:29:09 +04:00
Alexander Barkov
6afb2a37fd MDEV-20768 Turn INET functions into a function collection plugin 2019-10-07 23:17:21 +04:00
Alexander Barkov
cbf6beba40 MDEV-20764 Add MariaDB_FUNCTION_COLLECTION_PLUGIN 2019-10-07 11:31:32 +04:00
Alexander Barkov
c717483c9d MDEV-20016 Add MariaDB_DATA_TYPE_PLUGIN 2019-10-04 22:14:44 +04:00
Sergei Golubchik
b710d01dc7 mark PAMv2 plugin stable 2019-10-04 15:58:47 +02:00
Marko Mäkelä
780d2bb8a7 Merge 10.4 into 10.5 2019-09-06 14:25:20 +03:00
Oleksandr Byelkin
4f10d0918d Merge branch '10.3' into 10.4 2019-09-02 14:57:05 +02:00
Alexander Barkov
afe6eb499d Revert "MDEV-20342 Turn Field::flags from a member to a method"
This reverts commit e86010f909.

Reverting on Monty's request, as this change makes merging
things from 10.5 to 10.2 much harder.
2019-08-14 20:27:00 +04:00
Alexander Barkov
e86010f909 MDEV-20342 Turn Field::flags from a member to a method 2019-08-14 13:33:01 +04:00
Alexander Barkov
c1599821a5 Merge remote-tracking branch 'origin/10.4' into 10.5 2019-08-13 23:49:10 +04:00
Marko Mäkelä
624dd71b94 Merge 10.4 into 10.5 2019-08-13 18:57:00 +03:00
Monty
05619f6989 Fixes based on warnings from gcc/clang and valgrind
- Initialize variables that could be used uninitialized
- Added extra end space to DbugStringItemTypeValue to get rid of warnings
  from c_ptr()
- Session_sysvars_tracker::update() accessed unitialized memory if called
  with NULL value.
- get_schema_stat_record() accessed unitialized memory if HA_KEY_LONG_HASH
  was used
- parse_vcol_defs() accessed random memory for tables without keys.
2019-08-12 10:48:38 +03:00
Alexey Botchkov
e244652831 MDEV-20246 Error compiling PAM plugin.
Ignore the setreuid() return here.
2019-08-03 01:02:32 +04:00
Oleksandr Byelkin
2792c6e7b0 Merge branch '10.3' into 10.4 2019-07-28 13:43:26 +02:00
Oleksandr Byelkin
d97342b6f2 Merge branch '10.2' into 10.3 2019-07-26 22:42:35 +02:00
Eugene Kosov
4c7a743964 Merge 10.3 into 10.4 2019-07-26 15:22:31 +03:00
Oleksandr Byelkin
cf8c2a3c3b Merge branch '10.1' into 10.2 2019-07-26 07:03:39 +02:00
Alexey Botchkov
51d58f566a MDEV-18350 Using audit plugin with MySQL, mysqld crashes when running COM_INIT_DB against invalid database.
mysql_event_general structure changed in 10.3.
the database_length should be size_t now instead of the int.
2019-07-26 08:44:43 +04:00
Marko Mäkelä
e9c1701e11 Merge 10.3 into 10.4 2019-07-25 18:42:06 +03:00
Oleksandr Byelkin
ae476868a5 Merge branch '5.5' into 10.1 2019-07-25 13:27:11 +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
Marko Mäkelä
70b226d966 Merge 10.2 into 10.3 2019-07-22 17:37:04 +03:00
Julius Goryavsky
1f54b662ae The test for the wsrep_info plugin needs the same flexible wsrep version checking as the tests for Galera (continuation of MDEV-18565 task) 2019-07-22 12:24:01 +02:00
Julius Goryavsky
abeacb9c82 The test for the wsrep_info plugin needs the same flexible wsrep version checking as the tests for Galera (continuation of MDEV-18565 task) 2019-07-22 12:20:49 +02:00