Commit graph

172203 commits

Author SHA1 Message Date
Alexey Botchkov
a06f2f430f MDEV-12078 Using spatial index changes type from point to geometry
In get_mm_tree we have to change Field_geom::geom_type to
        GEOMETRY as we have to let storing all types of the spatial features
        in the field. So now we restore the original geom_type as it's
        done.
2017-07-11 23:27:19 +04:00
Sergei Golubchik
6b99859fff after-merge fix for a7ed4644a6
(10.0+ changes, as specified in the MDEV)

and remove unused variable (compiler warning)
2017-07-06 23:47:38 +02:00
Sergei Golubchik
89dc445a55 Merge branch '5.5' into 10.0 2017-07-06 23:47:33 +02:00
Sergei Golubchik
4d21313549 coverity medium warnings 2017-07-06 23:46:28 +02:00
Sergei Golubchik
f305a7ce4b bugfix: long partition names 2017-07-06 19:09:47 +02:00
Oleksandr Byelkin
a7ed4644a6 MDEV-10146: Wrong result (or questionable result and behavior) with aggregate function in uncorrelated SELECT subquery
When outer reference resolved in a VIEW it still should mark aggregate function resolving border.
2017-07-05 09:07:50 +02:00
Daniel Black
23ac2dd2a4 sql_class: incorrect assignment in Security_context::destroy
Found by Coverity (id 971843).

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2017-07-04 10:26:29 +04:00
Daniel Black
89b81a9a24 ma_pagecache: release lock in pagecache_read
make_lock_and_pin didn't release the lock so we should.

Found by Coverity (id 972095).
2017-07-03 13:31:09 +04:00
Daniel Black
2328860379 ma_loghandler: translog_set_only_in_buffers failed to release lock
Release the lock for the error path.

Found by Coverity (id 972093).
2017-07-03 13:14:05 +04:00
Daniel Black
051f90a534 ma_loghandler: release file_header_lock on error
translog_stop_writing doesn't release a lock (though
does to a DBUG_ASSERT).

Better to just release the lock.

Found by Coverity id 972092
2017-07-03 13:05:35 +04:00
Daniel Black
623c3f6731 thread_group_close: release mutex in all branches
Found by Coverity scan - id 92087
2017-07-03 12:51:30 +04:00
Daniel Black
cb870674d4 ha_archive::info remove hidden assignment
max_data_file_size is overwritten in next statement
so this assignment didn't ever get used.

Found by Coverity (ID 1409644)
2017-07-03 11:47:44 +04:00
Daniel Black
9fc71eebb6 item_timefunc: identical operands
CID 971836 (#1 of 1): Same on both sides (CONSTANT_EXPRESSION_RESULT)
pointless_expression: The expression val != end && val != end does not
accomplish anything because it evaluates to either of its identical
operands, val != end.
2017-07-03 11:15:44 +04:00
Andrei Elkin
946a07e8a8 Fix for MDEV-9670 server_id mysteriously set to 0
Problem was that in a circular replication setup the master remembers
position to events it has generated itself when reading from a slave.
If there are no new events in the queue from the slave, a
Gtid_list_log_event is generated to remember the last skipped event.
The problem happens if there is a network delay and we generate a
Gtid_list_log_event in the middle of the transaction, in which case there
will be an implicit comment and a new transaction with serverid=0 will be
logged.

The fix was to not generate any Gtid_list_log_events in the middle of a
transaction.
2017-07-02 19:47:30 +03:00
Monty
46d6f74c48 Fix for MDEV-13191. Assert for !is_set() when doing LOAD DATA
This could happen when the client connection dies while sending a progress
report packet.
Fixed by not raising any errors when sending progress packets.
2017-07-02 14:59:06 +03:00
Jacob Mathew
21689d1252 Run spider mtr suites in 10.0 only on demand. 2017-06-30 15:58:27 -07:00
Sergei Golubchik
92928bcdd9 Merge branch '5.5' into 10.0 2017-06-29 23:32:18 +02:00
Sergei Golubchik
4db6e1e4a5 uninitialized variable 2017-06-29 20:47:08 +02:00
Vicențiu Ciorbaru
5c89f23b45 Fix debug assert post MDEV-10306
tmp variable now points to str->ptr() buffer, not tmp_value buffer.
Comparing pointers otherwise can lead to false assertion errors as we
don't know where buffers are allocated in respect to each other.
2017-06-29 21:34:37 +03:00
Sergei Golubchik
a02ba9c1c9 Merge branch '5.5' into 10.0 2017-06-28 10:10:31 +02:00
Sergei Golubchik
d5cd334504 MDEV-13187 incorrect backslash parsing in clients
cover ANSI_QUOTES and NO_BACKSLASH_ESCAPES in mysqltest
2017-06-27 14:00:37 +02:00
Sergei Golubchik
39385ff7b2 MDEV-13187 incorrect backslash parsing in clients
don't do backslash escapes inside backticks
2017-06-27 13:25:50 +02:00
Vicențiu Ciorbaru
8baf9b0c46 Merge remote-tracking branch '5.5' into 10.0 2017-06-20 12:31:17 +03:00
Sergei Golubchik
ded614d7db MDEV-12778 mariadb-10.1 FTBFS on GNU/Hurd due to use of PATH_MAX 2017-06-19 16:34:50 +02:00
Marko Mäkelä
5e4f4ec821 MDEV-12975 InnoDB redo log minimum size check uses detected file size instead of requested innodb_log_file_size
log_calc_max_ages(): Use the requested size in the check, instead of
the detected redo log size. The redo log will be resized at startup
if it differs from what has been requested.
2017-06-19 15:59:19 +03:00
Alexander Barkov
3a37afec29 MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
The bug happens because of a combination of unfortunate circumstances:

1. Arguments args[0] and args[2] of Item_func_concat point recursively
(through Item_direct_view_ref's) to the same Item_func_conv_charset.
Both args[0]->args[0]->ref[0] and args[2]->args[0]->ref[0] refer to
this Item_func_conv_charset.

2. When Item_func_concat::args[0]->val_str() is called,
Item_func_conv_charset::val_str() writes its result to
Item_func_conc_charset::tmp_value.

3. Then, for optimization purposes (to avoid copying),
Item_func_substr::val_str() initializes Item_func_substr::tmp_value
to point to the buffer fragment owned by Item_func_conv_charset::tmp_value
Item_func_substr::tmp_value is returned as a result of
Item_func_concat::args[0]->val_str().

4. Due to optimization to avoid memory reallocs,
Item_func_concat::val_str() remembers the result of args[0]->val_str()
in "res" and further uses "res" to collect the return value.

5. When Item_func_concat::args[2]->val_str() is called,
Item_func_conv_charset::tmp_value gets overwritten (see #1),
which effectively overwrites args[0]'s Item_func_substr::tmp_value (see #3),
which effectively overwrites "res" (see #4).

This patch does the following:

a. Changes Item_func_conv_charset::val_str(String *str) to use
   tmp_value and str the other way around. After this change tmp_value
   is used to store a temporary result, while str is used to return the value.
   The fixes the second problem (without SUBSTR):
     SELECT CONCAT(t2,'-',t2) c2
       FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub;
   As Item_func_concat::val_str() supplies two different buffers when calling
   args[0]->val_str() and args[2]->val_str(), in the new reduction the result
   created during args[0]->val_str() does not get overwritten by
   args[2]->val_str().

b. Fixing the same problem in val_str() for similar classes

   Item_func_to_base64
   Item_func_from_base64
   Item_func_weight_string
   Item_func_hex
   Item_func_unhex
   Item_func_quote
   Item_func_compress
   Item_func_uncompress
   Item_func_des_encrypt
   Item_func_des_decrypt
   Item_func_conv_charset
   Item_func_reverse
   Item_func_soundex
   Item_func_aes_encrypt
   Item_func_aes_decrypt
   Item_func_buffer

c. Fixing Item_func::val_str_from_val_str_ascii() the same way.
   Now Item_str_ascii_func::ascii_buff is used for temporary value,
   while the parameter passed to val_str() is used to return the result.
   This fixes the same problem when conversion (from ASCII to e.g. UCS2)
   takes place. See the ctype_ucs.test for example queries that returned
   wrong results before the fix.

d. Some Item_func descendand classes had temporary String buffers
   (tmp_value and tmp_str), but did not really use them.
   Removing these temporary buffers from:

   Item_func_decode_histogram
   Item_func_format
   Item_func_binlog_gtid_pos
   Item_func_spatial_collection:

e. Removing Item_func_buffer::tmp_value, because it's not used any more.

f. Renaming Item_func_[un]compress::buffer to "tmp_value",
   for consistency with other classes.

Note, this patch does not fix the following classes
(although they have a similar problem):

   Item_str_conv
   Item_func_make_set
   Item_char_typecast

They have a complex implementations and simple swapping between "tmp_value"
and "str" won't work. These classes will be fixed separately.
2017-06-19 12:45:32 +04:00
Sergei Golubchik
48429359d6 MDEV-4646 No mysqld-debug or debuginfo in MariaDB-Server RPM 2017-06-18 21:53:45 +02:00
Daniel Black
e548e2184b Use CPACK_RPM_FILE_NAME="RPM-DEFAULT"
This has been implemented in for cmake-3.6 to match distro version
of what the filename should look like.

Thanks to Domen Vranka for the suggestion.
2017-06-18 21:53:45 +02:00
Sergei Golubchik
c7141fa75d MDEV-13002 mysqltest regex replace results in incorrect result
regex didn't replace lines that were split by 16K chunk reads.
2017-06-18 21:53:45 +02:00
Vicențiu Ciorbaru
f0ad93403f MDEV-12666: CURRENT_ROLE() and DATABASE() does not work in a view
The problem lies in how CURRENT_ROLE is defined. The
Item_func_current_role inherits from Item_func_sysconst, which defines
a safe_charset_converter to be a const_charset_converter.

During view creation, if there is no role previously set, the current_role()
function returns NULL.

This is captured on item instantiation and the
const_charset_converter call subsequently returns an Item_null.
In turn, the function is replaced with Item_null and the view is
then created with an Item_null instead of Item_func_current_role.

Without this patch, the first SHOW CREATE VIEW from the testcase would
have a where clause of WHERE role_name = NULL, while the second SHOW
CREATE VIEW would show a correctly created view.

The same applies for the DATABASE function, as it can change as well.

There is an additional problem with CURRENT_ROLE() when used in a
prepared statement. During prepared statement creation we used to set
the string_value of the function to the current role as well as the
null_value flag. During execution, if CURRENT_ROLE was not null, the
null_value flag was never set to not-null during fix_fields.

Item_func_current_user however can never be NULL so it did not show this
problem in a view before. At the same time, the CURRENT_USER() can not
be changed between prepared statement execution and creation so the
implementation where the value is stored during fix_fields is
sufficient.

Note also that DATABASE() function behaves differently during prepared
statements. See bug 25843 for details or commit
7e0ad09edf
2017-06-15 19:20:35 +03:00
Vicențiu Ciorbaru
34da3be8a8 MDEV-10463: Granted as a whole to roles, databases are not show in SHOW DATABASES
The problem lies in not checking role privileges as well during SHOW
DATABASES command. This problem is also apparent for SHOW CREATE
DATABASE command.

Other SHOW COMMANDS make use of check_access, which in turn makes use of
acl_get for both priv_user and priv_role parts, which allows them to
function correctly.
2017-06-15 19:20:35 +03:00
=Ian Gilfillan
2579b252dd Update MariaDB Foundation sponsors 2017-06-15 14:42:41 +04:00
Sergei Golubchik
c661b4d0fb MDEV-13017 LOCK TABLE fails with irrelevant error while working with tables affected by ANSI_QUOTES 2017-06-14 13:22:37 +02:00
Sergei Golubchik
5cbbfe9f54 cleanup: remove duplicate code 2017-06-14 11:31:02 +02:00
Sergei Golubchik
918e47030b MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
if a forced plugin is disabled (for any reason, e.g. invalid command-line
option) - it's an error
2017-06-14 11:30:32 +02:00
Sergei Golubchik
70b94c35d7 cleanup: move common test into a function 2017-06-14 11:27:36 +02:00
Marko Mäkelä
1d5a306e38 MDEV-12873 InnoDB SYS_TABLES.TYPE incompatibility for PAGE_COMPRESSION in MariaDB 10.2.2 to 10.2.6
Add a test case for corrupting SYS_TABLES.TYPE,
and for ROW_FORMAT=REDUNDANT, the unused field SYS_TABLES.MIX_LEN
that must be ignored (InnoDB before MySQL 5.5 wrote uninitialized
garbage to this column).

MariaDB 10.0 appears to validate the SYS_TABLES.TYPE properly.
This is a test-only change.
2017-06-13 17:20:38 +03:00
Vladislav Vaintroub
74e4cf70d0 MDEV-13059 XtraDB hangs on Windows due to failing to release block->lock X-latch
in innodb_read_only mode.

The reason for the hang is that there was no notification received about
completed read io. File handles are bound to completion_port, and there
were no background "write" threads that would be waiting on completion_port,
only 2 "read" threads waiting on read_completion_port were active.

The fix is to use a single IO completion port for all IOs, if
innodb_read_only is set.
2017-06-12 18:43:23 +00:00
Marko Mäkelä
75b35a3b68 Partially disable a test affected by MDEV-13059 2017-06-12 14:10:39 +03:00
Marko Mäkelä
4325041df6 MDEV-13057 innodb_read_only=1 should avoid creating buf_flush_page_cleaner_thread
When the server is started in innodb_read_only mode, there cannot be
any writes to persistent InnoDB/XtraDB files. Just like the creation
of buf_flush_page_cleaner_thread is skipped in this case, also
the creation of the XtraDB-specific buf_flush_lru_manager_thread
should be skipped.
2017-06-12 11:08:06 +03:00
Marko Mäkelä
417434f12d MDEV-13039 innodb_fast_shutdown=0 may fail to purge all undo log
When a slow shutdown is performed soon after spawning some work for
background threads that can create or commit transactions, it is possible
that new transactions are started or committed after the purge has finished.
This is violating the specification of innodb_fast_shutdown=0, namely that
the purge must be completed. (None of the history of the recent transactions
would be purged.)

Also, it is possible that the purge threads would exit in slow shutdown
while there exist active transactions, such as recovered incomplete
transactions that are being rolled back. Thus, the slow shutdown could
fail to purge some undo log that becomes purgeable after the transaction
commit or rollback.

srv_undo_sources: A flag that indicates if undo log can be generated
or the persistent, whether by background threads or by user SQL.
Even when this flag is clear, active transactions that already exist
in the system may be committed or rolled back.

innodb_shutdown(): Renamed from innobase_shutdown_for_mysql().
Do not return an error code; the operation never fails.
Clear the srv_undo_sources flag, and also ensure that the background
DROP TABLE queue is empty.

srv_purge_should_exit(): Do not allow the purge to exit if
srv_undo_sources are active or the background DROP TABLE queue is not
empty, or in slow shutdown, if any active transactions exist
(and are being rolled back).

srv_purge_coordinator_thread(): Remove some previous workarounds
for this bug.

innobase_start_or_create_for_mysql(): Set buf_page_cleaner_is_active
and srv_dict_stats_thread_active directly. Set srv_undo_sources before
starting the purge subsystem, to prevent immediate shutdown of the purge.
Create dict_stats_thread and fts_optimize_thread immediately
after setting srv_undo_sources, so that shutdown can use this flag to
determine if these subsystems were started.

dict_stats_shutdown(): Shut down dict_stats_thread. Backported from 10.2.

srv_shutdown_table_bg_threads(): Remove (unused).
2017-06-09 16:20:42 +03:00
Marko Mäkelä
a9117c9008 Correct a merge error of MDEV-11626 2017-06-09 13:44:04 +03:00
Jan Lindström
d03abc71a4 MDEV-12609: Allow suppression of InnoDB log messages about reserving extents
Removed this output.
2017-06-08 10:34:10 +03:00
Igor Babaev
b850fc66ca Fixed the bug mdev-12855.
This is actually a legacy bug:
SQL_SELECT::test_quick_select() was called
with SQL_SELECT::head not set.
It looks like that this problem can be
reproduced only on queries with ORDER BY
that use IN predicates converted to semi-joins.
2017-06-07 22:54:57 -07:00
Igor Babaev
151f4e9b4a Fixed the bug mdev-12963.
This patch corrects the fix for bug mdev-7599.
When the min/max optimization of the function
opt_sum_query() optimizes away all tables of
a subquery it should not ever be rolled back.
2017-06-07 16:29:55 -07:00
Igor Babaev
c258ca2463 Fixed the bug mdev-12838.
If the optimizer chose an execution plan where
a semi-join nest were materialized and the
result of materialization was scanned to access
other tables by ref access it could build a key
over columns of the tables from the nest that
were actually inaccessible.
The patch performs a proper check whether a key
that uses columns of the tables from a materialized
semi-join nest can be employed to access outer tables.
2017-06-07 12:45:32 -07:00
Marko Mäkelä
d8d39721df Follow-up to MDEV-12042 (test innodb_page_size variants)
innodb_page_size_small: A new set of combinations, for
innodb_page_size up to 16k. In MariaDB 10.0, this does not
make a difference, but in 10.1 and later, innodb_page_size
would cover 32k and 64k, for which ROW_FORMAT=COMPRESSED
is not available.

Enable these combinations in a few InnoDB tests.
2017-06-06 09:34:09 +03:00
Marko Mäkelä
151daaf480 MDEV-12994 innodb_fast_shutdown=0 skips change buffer merge; fast shutdown does it
srv_master_thread(): Pass the correct parameter to srv_shutdown().
This bug was introduced in MDEV-12052, and it affects the MariaDB 10.1.24
release.
2017-06-05 15:16:15 +03:00
Elena Stepanova
ab62b7538f MDEV-12042 Re-bootstrap the server if InnoDB options are incompatible 2017-06-02 01:46:25 +03:00
Marko Mäkelä
c2ef0bb6ce Merge 5.5 into 10.0 2017-05-29 13:15:36 +03:00