Commit graph

179547 commits

Author SHA1 Message Date
Olivier Bertrand
74ffcbc135 - Typo (from 10.1) Modified: storage/connect/value.cpp 2017-10-17 21:50:17 +02:00
Vicențiu Ciorbaru
4090ef820e Fix check_role_is_granted for embedded 2017-10-17 15:33:19 +03:00
Sergei Petrunia
cd7fa0fd62 MDEV-11934: MariaRocks: Group Commit with binlog
Port the previous patch:
- Implement MariaDB's Group Commit API. This is a first
   attempt which lacks the expected performance.

To newer MariaDB (which includes newer MyRocks)
2017-10-17 12:04:53 +03:00
Sergei Golubchik
b000e16956 Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL))
based on:

commit f7316aa0c9
Author: Ajo Robert <ajo.robert@oracle.com>
Date:   Thu Aug 24 17:03:21 2017 +0530

    Bug#26361149  MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST,
                           COL), NAME_CONST('NAME', NULL))

    Backport of Bug#19143243 fix.

    NAME_CONST item can return NULL_ITEM type in case of incorrect arguments.
    NULL_ITEM has special processing in Item_func_in function.
    In Item_func_in::fix_length_and_dec an array of possible comparators is
    created. Since NAME_CONST function has NULL_ITEM type, corresponding
    array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE.
    ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(),
    so the NULL_ITEM is attempted compared with an empty comparator.
    The fix is to disable the caching of Item_name_const item.
2017-10-17 11:04:09 +02:00
Sergei Golubchik
df5f25fa7a Merge branch 'mysql/5.5' into 5.5 2017-10-17 10:18:17 +02:00
Marko Mäkelä
a63102226e MDEV-14082 Enforcing innodb_open_files leads to fil_system->mutex problem
fil_mutex_enter_and_prepare_for_io(): Reacquire fil_system->mutex after
failing to close a file and before retrying.
2017-10-17 10:58:46 +03:00
Sergei Golubchik
b036b6b594 MDEV-13937 Aria engine: Internal Error 160 after partition handling
Partition wasn't setting HA_OPTION_PACK_RECORD on ALTER TABLE
if the row format was PAGE.

(so one bit in the null bitmap was reserved for a deleted bit -
see make_empty_rec - and all actual null bits were one off)
2017-10-17 07:37:39 +02:00
Sergei Golubchik
19a702a85c MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option
if it's a DROP TABLE, we cannot detect whether a table is
temporary by looking in thd->temporary_tables - because the
table might simply not exist at all.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
421716391b MDEV-13912 Can't refer the same column twice in one ALTER TABLE
backport ce6c0e584e

MDEV-8960: Can't refer the same column twice in one ALTER TABLE

Problem was that if column was created in alter table when
it was refered again it was not tried to find from list
of current columns.

mysql_prepare_alter_table:
  There is two cases
    (1) If alter table adds a new column and then later alter
        changes the field definition, there was no check from
	list of new columns, instead an incorrect error was given.
    (2) If alter table adds a new column and then later alter
        changes the default, there was no check from list of
	new columns, instead an incorrect error was given.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
93144b9e92 MDEV-13440 mysql_install_db fails with hard-coded langdir
always search in compile-time specified paths
INSTALL_BINDIR, INSTALL_SBINDIR, INSTALL_MYSQLSHAREDIR. User
can set them to arbitrary values, it's not enough to search only
in their usual values of bin, sbin and libexec, share and share/mysql.
2017-10-17 07:37:39 +02:00
Sergei Golubchik
52516706c8 cleanup mysql_install_db
1. detect resolveip location, don' assume it's in $basedir/bin
2. don't guess $scriptdir to (incorrectly) construct the $0 path
3. rename find_in_basedir -> find_in_dirs, don't prepend $basedir
   automatically. This allows to use identical path lists in
   find_in_dirs and in cannot_find_file.
4. move search path lists to CMakeLists.txt to avoid specifying the
   same path list twice (in find_in_dirs and in cannot_find_file).
2017-10-17 07:37:39 +02:00
Sergei Golubchik
d76f5774fe MDEV-13459 Warnings, when compiling with gcc-7.x
mostly caused by -Wimplicit-fallthrough
2017-10-17 07:37:39 +02:00
Marko Mäkelä
d11af09865 MDEV-14076 InnoDB: Failing assertion when accessing INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES upon upgrade from 10.1.0 to 10.1.20
i_s_dict_fill_sys_tablespaces(): Adjust the tablespace flags if needed.
2017-10-16 20:54:07 +03:00
Marko Mäkelä
9a791c9c8d MDEV-12676 MySQL#78423 InnoDB FTS duplicate key error
fts_get_next_doc_id(): Assign the first and subsequent FTS_DOC_ID
in the same way: by post-incrementing the cached value.
If there is a user-specified FTS_DOC_ID, do not touch the internal
sequence.
2017-10-16 19:11:30 +03:00
Marko Mäkelä
1eee3a3fb7 MDEV-13051 MySQL#86607 InnoDB crash after failed ADD INDEX and table_definition_cache eviction
There are two bugs related to failed ADD INDEX and
the InnoDB table cache eviction.

dict_table_close(): Try dropping failed ADD INDEX when releasing
the last table handle, not when releasing the last-but-one.

dict_table_remove_from_cache_low(): Do not invoke
row_merge_drop_indexes() after freeing all index metadata.
Instead, directly invoke row_merge_drop_indexes_dict() to
remove the metadata from the persistent data dictionary
and to free the index pages.
2017-10-16 19:11:30 +03:00
Olivier Bertrand
c83e2a6345 - Fix a bug in TYPVAL<PSZ> compute causing it sometime not to be executed
This was the cause of the bug in CalculateArray
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/value.cpp

- Avoid some compiler warnings
  modified:   storage/connect/mongo.cpp
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/tabutil.cpp
2017-10-16 15:08:17 +02:00
Olivier Bertrand
6691d12e2d - Make another temporary fix for the compiler bug in CalculateArray
modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjson.cpp
2017-10-16 00:48:03 +02:00
Olivier Bertrand
bcfb5b2de9 - Update version number
modified:   storage/connect/ha_connect.cc

- Include MONGO in all Java enabled distributions
  Mongo will be enabled only for 10.2 and 10.3
  modified:   storage/connect/CMakeLists.txt

- Change JDBC_SUPPORT to JAVA_SUPPORT which also replaces MONGO_SUPPORT
  MONGO_SUPPORT is now just used to enable the MONGO table type
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h
  modified:   storage/connect/mongo.cpp
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h

- Move MakeSelector function from FILTER to mongo.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/cmgoconn.cpp
  modified:   storage/connect/jmgoconn.cpp
  modified:   storage/connect/mongo.cpp

- Do mongo_init only on first use of the MongoDB C Driver
  This will permit to delay load the mongo lib on Windows
  modified:   storage/connect/cmgoconn.cpp
  modified:   storage/connect/cmgoconn.h
  modified:   storage/connect/ha_connect.cc

- Replace NEW_VAR by a test on MYSQL_VERSION_ID
  modified:   storage/connect/ha_connect.cc

- Suppress enable_mongo session variable
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/mycat.cc

- Make some function headers identical in .h and .cc file
  (replacing const char* by PCSZ)
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h

- Change a parameter type from uchar* to const uchar*
  (for ScanRecord and CheckRecord)
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h

- Changes on LIKE and NOT LIKE does not fix a bug yet
  modified:   storage/connect/ha_connect.cc

- Suppress PIVOT_SUPPORT (PIVOT type is unconditionnal)
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/mycat.cc

- Change the strz function from inline to static
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h

- export the JavaConn class and the MgoColumns and IsNum functions
  modified:   storage/connect/javaconn.h
  modified:   storage/connect/json.h
  modified:   storage/connect/mongo.h

- Fix MDEV-13924
  modified:   storage/connect/jdbconn.cpp

- Make a temporary fix for the compiler bug in CalculateArray
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjson.cpp

- Typo
  modified:   storage/connect/jdbccat.h
  modified:   storage/connect/reldef.h
  modified:   storage/connect/tabext.h
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabxml.h
  modified:   storage/connect/valblk.h
  modified:   storage/connect/value.h
  modified:   storage/connect/xtable.h

- Fix a bug in MONGO tests by changing 'MONGO' to $TYPE
  modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

- Record test results to reflect all changes
  modified:   storage/connect/mysql-test/connect/r/json_java_2.result
  modified:   storage/connect/mysql-test/connect/r/json_java_3.result
  modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
  modified:   storage/connect/mysql-test/connect/r/mongo_c.result
  modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
  modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
2017-10-15 16:13:23 +02:00
Alexander Barkov
98cd0ec536 MDEV-10802 TIMESTAMP NOT NULL field with explicit_defaults_for_timestamp and NO_ZERO_DATE shouldn't throw error 2017-10-14 19:43:16 +04:00
halfspawn
75aabd03d5 MDEV-14013 : sql_mode=EMPTY_STRING_IS_NULL 2017-10-14 17:28:54 +04:00
Marko Mäkelä
ad46ce658a MDEV-14055 Assertion `page_rec_is_leaf(rec)' failed in lock_rec_validate_page
This was a false alarm in a debug check that was introduced in
commit 48192f963a which was a
10.2 code refactoring in preparation for
MDEV-11369 (instant ADD COLUMN) in 10.3.2. The code refactoring
only affected debug builds.

InnoDB B-tree record locks are only supposed to exist on leaf page
records. An assertion failed, because the debug function lock_validate()
was invoking lock_rec_block_validate() on a page for which there were
no locks set in the record lock bitmap. This could happen on a page split.
Especially when the index size grows from a single page to multiple pages,
the root page would transform from a leaf node into an internal node,
and its record lock bitmap would be emptied.

lock_validate(): Skip empty lock bitmaps.
2017-10-14 14:28:11 +03:00
Vladislav Vaintroub
bcd1a08eb3 Fix mtr to create a process dump on Window for hanging or looping processes 2017-10-13 22:24:25 +00:00
Marko Mäkelä
9ee840cd0a mariabackup: Properly call os_thread_exit() with detach=true
There is no call to os_thread_join(), so we should detach the thread
handles in order to avoid any resource leaks.
2017-10-13 22:22:03 +03:00
Marko Mäkelä
c65fdcf7c8 MDEV-14062 Upgrade from 10.0 fails on assertion during ALTER TABLE
The fix in MDEV-14022 was incomplete. We must adjust some more code
for the fact that SYS_INDEXES records may lack the column MERGE_THRESHOLD
that was "instantly" added in MySQL 5.7 and MariaDB 10.2.2.

dict_boot(): Hard-core SYS_INDEXES.MERGE_THRESHOLD as DEFAULT NULL.

dict_index_t::instant_field_value(), rec_offs_make_valid():
Tolerate the missing SYS_INDEXES.MERGE_THRESHOLD column.
2017-10-13 21:59:15 +03:00
Oleksandr Byelkin
3b7aa3017b Cleanup usage of DBUG_ASSERTS. 2017-10-13 19:32:38 +02:00
Oleksandr Byelkin
235b68299b MDEV-9619: Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS
Refer left expression indirectly in case it changes from execution to execution.
2017-10-13 19:32:38 +02:00
Igor Babaev
2bab29ebba Fixed the bug mdev-13135.
For each SELECT the list sj_nests is built by the
function simplify_joins() when scanning different
join nests. This function may be called several
times for the same join nest. That's why before
adding a new member to sj_nests it is necessary
to check if it's already in the list.
The code of simplify_joins() lacked this check and
as a result it could cause memory overwright for
some queries.
2017-10-13 07:24:54 -07:00
Sergey Vojtovich
8be76a6a90 MDEV-10892 - rpl.rpl_semi_sync_uninstall_plugin fails with Assertion `0' failure
in buildbot

Removed plugin_array_version: it is being checked without mutex protection and
thus is prone to data race and race conditions. In effect plugins are not
protected from concurrent destruction.

Removed state_mask inversion: doesn't seem to make any sense.

When collecting local plugins list, only add plugins that match state_mask.

Use plugin ref counting to protect against concurrent plugin destruction.
2017-10-13 16:50:58 +04:00
Sergei Petrunia
f11eaaa3f6 Merge branch 'bb-10.2-mariarocks' of github.com:MariaDB/server into 10.2
Conflicts:
	storage/rocksdb/ha_rocksdb.cc
2017-10-13 14:37:04 +03:00
Oleksandr Byelkin
a4868c3509 MDEV-9208: Function->Function->View = Mysqld segfault (Server crashes in Dependency_marker::visit_field on 2nd execution with merged subquery)
Prevent crossing name resolution border in finding item tables.
2017-10-13 12:35:17 +02:00
Sergei Petrunia
0507b09402 Merge branch '10.2' of github.com:MariaDB/server into bb-10.2-mariarocks-merge 2017-10-13 13:25:46 +03:00
Alexander Barkov
991b9ee735 MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 2017-10-13 07:06:09 +04:00
Eugene Kosov
f3ad3bbe77 fix data races 2017-10-12 18:26:22 +04:00
Jan Lindström
a4fa940bad MDEV-11336: Enable defragmentation on 10.2 when tests pass
Problem was that we could take page latches on different
order than wat is entitled with SX-lock. To follow the
latching order defined in WL#6326, acquire index->lock X-latch.
This entitles us to acquire page latches in any order for the index.

btr0btr.cc
	Document latch rules before and after MariaDB 10.2.2

sync0rw.cc
	Document latch compatibility rules better.

btr_defragment_merge_pages
	Fix parameter value.

btr_defragment_thread
	Acquire X-lock to dict_index_t::lock before restoring
	cursor position and continuing defragmentation.

ha_innobase::optimize
	Restore defragment feature.

Testing
	Add GIS-index and FT-index to table being defragmented.

	Defragmentation is not done to GIS-indexes and FT auxiliary
	tables.
2017-10-12 12:56:20 +03:00
Igor Babaev
4c9d19ee65 Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE
specification. In this case if the reference to the CTE is
the first one the specification should be detached from its
master and attached to the referencing select.

Also fixed the TYPE column in the lines of the EXPLAIN output
created for CTE tables.
2017-10-11 10:22:46 -07:00
Varun Gupta
dc8ac122bb MDEV-13928: Missing symbols building RocksDB on macOS 10.12.6
rdb_sst_info.cc must be compiled with RTTI
2017-10-11 21:51:09 +05:30
Alexander Barkov
3062445a64 MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
Changing Field::set_default from void to int.
It now uses the same return value notation with Field::store*()
and Item::save_in_field().
2017-10-11 18:13:44 +04:00
Sergey Vojtovich
7d2a7782fe Fixed build failure 2017-10-11 17:15:00 +04:00
Sergei Petrunia
8f6266e927 MDEV-13852: temporarily disable running tests on windows 2017-10-11 14:41:09 +03:00
Sergei Golubchik
f9066dc347 MDEV-14023 10.1 InnoDB tables with virtual columns cannot be accessed in 10.2
in 10.1 innodb was basically ignoring virtual columns. In particular,
information about them was not stored in system tables. To make 10.1
table usable in 10.2 it needs to be rebuilt to have virtual colunm
metadata properly recreated.

See also a followup:
MDEV-14046 Allow ALGORITHM=INPLACE for 10.1 tables that contain virtual columns
2017-10-11 12:00:47 +02:00
Eugene Kosov
62b21fc101 fix some data races (#464)
* fix some data races
2017-10-11 13:56:23 +04:00
Vicențiu Ciorbaru
b9418ed333 MDEV-13676: Field "create Procedure" is NULL, even if the the user has role which is the definer. (SHOW CREATE PROCEDURE)
During show create procedure we ommited to check the current role, if it
is the actual definer of the procedure. In addition, we should support
indirectly granted roles to the current role. Implemented a recursive
lookup to search the tree of grants if the rolename is present.

SQL Standard 2016, Part 5 Section 53 View I_S.ROUTINES selects
ROUTINE_BODY and its WHERE clause says that the GRANTEE must be
either PUBLIC, or CURRENT_USER or in the ENABLED_ROLES.
2017-10-11 12:15:52 +03:00
Marko Mäkelä
18a979df6f Fix a warning about unused variable
fil_ibd_create(): commit b731a5bcf2
introduced a variable that was unused outside Windows. Use it
on all platforms.
2017-10-11 12:00:52 +03:00
Marko Mäkelä
a0df2693a2 Remove an unused parameter
btr_store_big_rec_extern_fields(): Remove the unused parameter 'upd'
that was added in https://github.com/mysql/mysql-server/commit/ce0a1e85e24e48b8171f767b44330d
and merged to MariaDB 10.2.2
in commit 2e814d4702.
2017-10-11 12:00:52 +03:00
Alexey Botchkov
8e255b98ab MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK &&
is_bulk_op())' failed upon altering table with geometry field.

        Tests added.
2017-10-11 12:21:40 +04:00
Eugene Kosov
a4c23ac720 remove unndeded class member variable 2017-10-11 12:04:15 +04:00
Alexey Botchkov
fe0d2e1a2b MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK &&
is_bulk_op())' failed upon altering table with geometry field.

        Check for the validity of the DEFAULT value for the
        geometry field.
2017-10-11 11:57:26 +04:00
Vladislav Vaintroub
dd85ec6f28 Update AWS C++ SDK version
This fixes some truncation warnings on Win64
2017-10-11 08:45:59 +02:00
Vladislav Vaintroub
93690b96e2 Fix warnings in Win64 2017-10-11 08:44:24 +02:00
Vladislav Vaintroub
daabb4d055 Fix truncation warnings in connect 2017-10-11 08:36:04 +02:00