Commit graph

4009 commits

Author SHA1 Message Date
Marko Mäkelä
561b6d213c Revert "Merge pull request #275 from grooverdan/10.2-MDEV-11075-crc32-runtime-detect-getauxval"
This reverts commit edf4cc7519, reversing
changes made to 9320d8ae30.
2016-12-20 22:46:29 +02:00
Marko Mäkelä
229dd711d4 MDEV-11585 Hard-code the shared InnoDB temporary tablespace ID
Try hard-coding the ID as -2 instead of -1, so that they will not
be confused with ULINT_UNDEFINED on 32-bit platforms.
2016-12-20 22:42:13 +02:00
Marko Mäkelä
83dbb2d43a MDEV-11487 Revert InnoDB internal temporary tables from WL#7682
Post-push fix: Remove the orphaned file sess0sess.h.
2016-12-20 12:07:33 +02:00
Marko Mäkelä
a01bfc9fc2 MDEV-11602 InnoDB leaks foreign key metadata on DDL operations
Essentially revert MDEV-6759, which addressed a double free of memory
by removing the freeing altogether, introducing the memory leaks.
No double free was observed when running the test suite -DWITH_ASAN.

Replace some mem_heap_free(foreign->heap) with dict_foreign_free(foreign)
so that the calls can be located and instrumented more easily when needed.
2016-12-19 17:27:15 +02:00
Marko Mäkelä
8375a2c1ce MDEV-11585 Hard-code the shared InnoDB temporary tablespace ID at -1
MySQL 5.7 supports only one shared temporary tablespace.

MariaDB 10.2 does not support any other shared InnoDB tablespaces than
the two predefined tablespaces: the persistent InnoDB system tablespace
(default file name ibdata1) and the temporary tablespace
(default file name ibtmp1).

InnoDB is unnecessarily allocating a tablespace ID for the predefined
temporary tablespace on every startup, and it is in several places
testing whether a tablespace ID matches this dynamically generated ID.

We should use a compile-time constant to reduce code size and to avoid
unnecessary updates to the DICT_HDR page at every startup.

Using a hard-coded tablespace ID will should make it easier to remove the
TEMPORARY flag from FSP_SPACE_FLAGS in MDEV-11202.
2016-12-19 16:24:10 +02:00
Sergei Golubchik
8938031bc7 InnoDB: don't stop purge threads if there's work to do
in slow shutdown mode don't stop purge threads until they've
purged everything there is
2016-12-15 09:35:25 +01:00
Sergei Golubchik
8d770859c9 InnoDB purge thread and other bg threads
in slow shutdown mode stop all bg threads that might generate
new undo records to purge before stopping purge threads.
2016-12-15 09:34:37 +01:00
Sergei Golubchik
eabb0aef12 sporadic crashes of innodb.innodb_prefix_index_restart_server
in slow shutdown mode purge threads really must exit only when there is
nothing to purge. Restore the trx_commit_disallowed check and
don't stop purge threads until all connection thread transactions
are gone.
2016-12-15 09:33:59 +01:00
Sergei Golubchik
1b7a794b73 MDEV-11540 Unexpected system threads in the process list
name innodb background threads as such
2016-12-12 22:33:27 +01:00
Sergei Golubchik
1db438c833 MDEV-11066 use MySQL terminology for "virtual columns" 2016-12-12 20:35:51 +01:00
Sergei Golubchik
6eaa5fd210 bugfix: InnoDB doesn't support ICP on vcols 2016-12-12 20:35:50 +01:00
Sergei Golubchik
a72f1deb2d rename Virtual_column_info::expr_item
now, when expr_str is gone, expr_item can be unambiguously
renamed to expr.
2016-12-12 20:35:48 +01:00
Sergei Golubchik
1cae1af6f9 MDEV-5800 InnoDB support for indexed vcols
* remove old 5.2+ InnoDB support for virtual columns
  * enable corresponding parts of the innodb-5.7 sources
  * copy corresponding test cases from 5.7
  * copy detailed Alter_inplace_info::HA_ALTER_FLAGS flags from 5.7
     - and more detailed detection of changes in fill_alter_inplace_info()
  * more "innodb compatibility hooks" in sql_class.cc to
     - create/destroy/reset a THD (used by background purge threads)
     - find a prelocked table by name
     - open a table (from a background purge thread)

  * different from 5.7:
    - new service thread "thd_destructor_proxy" to make sure all THDs are
      destroyed at the correct point in time during the server shutdown
    - proper opening/closing of tables for vcol evaluations in
       + FK checks (use already opened prelocked tables)
       + purge threads (open the table, MDLock it, add it to tdc, close
         when not needed)
    - cache open tables in vc_templ
    - avoid unnecessary allocations, reuse table->record[0] and table->s->default_values
    - not needed in 5.7, because it overcalculates:
      + tell the server to calculate vcols for an on-going inline ADD INDEX
      + calculate vcols for correct error messages

  * update other engines (mroonga/tokudb) accordingly
2016-12-12 20:27:42 +01:00
Sergei Golubchik
7fca91f2b4 cleanup: InnoDB, dict_create_add_foreign_to_dictionary()
remove 'table' argument, remnant of 5.6, does not exist in 5.7
2016-12-12 20:27:42 +01:00
Sergei Golubchik
528dd5f20c cleanup: InnoDB, remove index_field_t::col_name
* remnant of 5.6, does not exist in 5.7. bad merge?
* also remove dict_table_get_col_name_for_mysql(), it was only
  used when index_field_t::col_name was not NULL
2016-12-12 20:27:41 +01:00
Sergei Golubchik
b66976abb4 cleanup: InnoDB, various minor issues
* fix "unused pending_checkpoint_mutex_key" compiler warning
* clarify/simplify get_field_offset()
* typos, comments
* unused (forgotten) declaration of create_options_are_invalid()
* fix my_error(ER_WRONG_KEY_COLUMN) calls
* crash in row_upd_sec_index_entry()
* double if (ret != 0)
* don't duplucate PSI_INSTRUMENT_ME lines
* useless break; after return();
* remove unused xtradb-only "cursor_read_view" stuff
* code formatting
* simplify dropped column detection
* redundant assignment
2016-12-12 20:27:41 +01:00
Sergei Golubchik
a3614d33e8 cleanup: FOREIGN_KEY_INFO
instead of returning strings for CASCADE/RESTRICT
from every storage engine, use enum values
2016-12-12 20:27:39 +01:00
Sergei Golubchik
163478db45 cleanup: InnoDB: is_partition() 2016-12-12 20:27:31 +01:00
Sergei Golubchik
46ae210422 cleanup: my_strerror 2016-12-12 20:27:29 +01:00
Sergei Golubchik
867809f23a bugfix: compile InnoDB w/o P_S 2016-12-12 20:27:23 +01:00
Sergei Golubchik
0852cf534a say MariaDB in InnoDB error messages, not MySQL 2016-12-12 20:27:21 +01:00
Sergei Golubchik
f7dcd8a0e8 shut up annoying InnoDB warning when --gdb 2016-12-12 20:27:20 +01:00
Daniel Black
e76183f099 MDEV-11075: Power - runtime detection of optimized instructions
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-12 15:35:08 +11:00
Marko Mäkelä
c868acdf65 MDEV-11487 Revert InnoDB internal temporary tables from WL#7682
WL#7682 in MySQL 5.7 introduced the possibility to create light-weight
temporary tables in InnoDB. These are called 'intrinsic temporary tables'
in InnoDB, and in MySQL 5.7, they can be created by the optimizer for
sorting or buffering data in query processing.

In MariaDB 10.2, the optimizer temporary tables cannot be created in
InnoDB, so we should remove the dead code and related data structures.
2016-12-09 12:05:07 +02:00
Marko Mäkelä
b0266b6a60 Use mtr_memo_contains_flagged() instead of mtr_memo_contains().
This was originally part of MDEV-11487.
2016-12-09 12:03:24 +02:00
Marko Mäkelä
c6017b77e0 Address my review comments in the contributed patch. 2016-12-09 09:12:32 +02:00
Marko Mäkelä
64d29c6575 Merge branch '10.2-MDEV-9872-crc32-generic-message' of https://github.com/grooverdan/mariadb-server into grooverdan-10.2-MDEV-9872-crc32-generic-message 2016-12-09 09:04:35 +02:00
Daniel Black
50617c42d4 MDEV-11075: allow software crc32c on Power8 (for BE) 2016-12-09 15:29:42 +11:00
Daniel Black
850ed6e4cc MDEV-11075: changing to algorithm innodb from crc32
With innodb compressed pages formerly as crc32 changing to the
innodb checksum, optimize for speed by only calcuating the big
endian variant of crc32 after checking that the little endian
doesn't validate the page.

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-09 15:17:12 +11:00
Marko Mäkelä
7ca1e2abad MDEV-11422 rpl.rpl_parallel_optimistic_nobinlog failed in buildbot with "InnoDB: Killing connection failed Deadlock"
innobase_kill_query(): Remove the bogus warning message
(for the valid outcome err==DB_DEADLOCK) that was added in

commit fec844aca8
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date:   Tue Sep 6 09:43:16 2016 +0300

    Merge InnoDB 5.7 from mysql-5.7.14.

Also, remove some redundant variables and add a debug assertion for
enforcing the proper outcome of lock_trx_handle_wait().
2016-12-08 17:23:41 +02:00
Vladislav Vaintroub
6816c80c30 MDEV-11435 - fix integer divided by zero exception when calculating
buffer pool size

The reason for the exception is previous overflow in multiplication of
two 32bit integers (product was 0 rather than expected 8GB, due
to truncation)
2016-12-08 15:41:09 +01:00
Jan Lindström
7f504c7246 Merge branch '10.2-vats' of https://github.com/sensssz/server into sensssz-10.2-vats 2016-12-07 09:18:41 +02:00
Marko Mäkelä
660521a43a Merge pull request #263 from grooverdan/10.2-MDEV-11451-isfinite
MDEV-11451: isinf || isnan -> !isfinite
2016-12-05 17:01:28 +02:00
Marko Mäkelä
cc85ba8f2e MDEV-11233 CREATE FULLTEXT INDEX with a token longer than 127 bytes
crashes server

This bug is the result of merging the Oracle MySQL follow-up fix
BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX
without merging the base bug fix:
Bug#79475 Insert a token of 84 4-bytes chars into fts index causes
server crash.

Unlike the above mentioned fixes in MySQL, our fix will not change
the storage format of fulltext indexes in InnoDB or XtraDB
when a character encoding with mbmaxlen=2 or mbmaxlen=3
and the length of a word is between 128 and 84*mbmaxlen bytes.
The Oracle fix would allocate 2 length bytes for these cases.

Compatibility with other MySQL and MariaDB releases is ensured by
persisting the used maximum length in the SYS_COLUMNS table in the
InnoDB data dictionary.

This fix also removes some unnecessary strcmp() calls when checking
for the legacy default collation my_charset_latin1
(my_charset_latin1.name=="latin1_swedish_ci").

fts_create_one_index_table(): Store the actual length in bytes.
This metadata will be written to the SYS_COLUMNS table.

fts_zip_initialize(): Initialize only the first byte of the buffer.
Actually the code should not even care about this first byte, because
the length is set as 0.

FTX_MAX_WORD_LEN: Define as HA_FT_MAXCHARLEN * 4 aka 336 bytes,
not as 254 bytes.

row_merge_create_fts_sort_index(): Set the actual maximum length of the
column in bytes, similar to fts_create_one_index_table().

row_merge_fts_doc_tokenize(): Remove the redundant parameter word_dtype.
Use the actual maximum length of the column. Calculate the extra_size
in the same way as row_merge_buf_encode() does.
2016-12-05 16:32:03 +02:00
Daniel Black
b11eb36963 MDEV-11451: isinf || isnan -> !isfinite
There are only 3 logical states for a number. The isfinite is a
single function call rather than multiple leaving scope for compiler
/architecture optimization.

Changed the logic as follows in a few files.

my_isinf(square) || my_isnan(square) -> !isfinite(square)

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-05 09:22:00 +11:00
Daniel Black
410bf82b98 MDEV-9872: Valgrind supports CRC32B and CRC32Q since valgrind-3.6.1
We don't need to drop down to unoptimized crc because of valgrind now.

Valgrind-3.6.1 was released 16 February 2011.

The Power8 ASM instructions seem to be supported in 3.9.0 (31 October 2013).

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-05 08:35:55 +11:00
Jan Lindström
1e2b46d5d5 MDEV-11168: InnoDB: Failing assertion: !other_lock || wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE) || wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)
Merge fix from 10.1.
2016-12-02 17:28:39 +02:00
Marko Mäkelä
33ed16c750 MDEV-11236 Failing assertion: state == TRX_STATE_NOT_STARTED
trx_state_eq(): Add the parameter bool relaxed=false, to
allow trx->state==TRX_STATE_NOT_STARTED where a different
state is expected, if an error has been reported.

trx_release_savepoint_for_mysql(): Pass relaxed=true to
trx_state_eq(). That is, allow the transaction to be idle
when ROLLBACK TO SAVEPOINT is attempted after an error
has been reported to the client.
2016-12-02 16:44:53 +02:00
sensssz
02c8852373 Bug fix: consider lock wait mode first. 2016-12-01 13:50:00 -05:00
Marko Mäkelä
0b66d3f70d MDEV-11426 Remove InnoDB INFORMATION_SCHEMA.FILES implementation
MySQL 5.7 introduced WL#7943: InnoDB: Implement Information_Schema.Files
to provide a long-term alternative for accessing tablespace metadata.
The INFORMATION_SCHEMA.INNODB_* views are considered internal interfaces
that are subject to change or removal between releases. So, users should
refer to I_S.FILES instead of I_S.INNODB_SYS_TABLESPACES to fetch metadata
about CREATE TABLESPACE.

Because MariaDB 10.2 does not support CREATE TABLESPACE or
CREATE TABLE…TABLESPACE for InnoDB, it does not make sense to support
I_S.FILES either. So, let MariaDB 10.2 omit the code that was added in
MySQL 5.7. After this change, I_S.FILES will report the empty result,
unless some other storage engine in MariaDB 10.2 implements the interface.
(The I_S.FILES interface was originally created for the NDB Cluster.)
2016-12-01 13:16:25 +02:00
Jan Lindström
943baa3ba8 MDEV-11168: InnoDB: Failing assertion: !other_lock || wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE) || wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)
Problem was that we moved lock request to head of lock queue
    even when lock request has to wait.
2016-12-01 13:07:28 +02:00
Marko Mäkelä
2c9bb42d90 MDEV-11432 Change the informational redo log format tag to "MariaDB 10.2.3"
MariaDB 10.2 incorporates MySQL 5.7. MySQL 5.7.9 (the first GA release
of the series) introduced an informational field to the InnoDB redo log
header, which identifies the server version where the redo log files
were created (initialized, resized or updated), in
WL#8845: InnoDB: Redo log format version identifier.

The informational message would be displayed to the user, for example
if someone tries to start up MySQL 8.0 after killing a MariaDB 10.2 server.
In the current MariaDB 10.2 source code, the identifier string would
misleadingly say "MySQL 5.7.14" (using the hard-coded version number in
univ.i) instead of "MariaDB 10.2.3" (using the contents of the VERSION
file, the build system copies to config.h and my_config.h).

This is only a cosmetic change. The compatibility check is based on a
numeric identifier.

We should probably also change the numeric identifier and some logic
around it. MariaDB 10.2 should refuse to recover from a crashed MySQL 5.7
instance, because the redo log might contain references to shared tablespaces,
which are not supported by MariaDB 10.2. Also, when MariaDB 10.2 creates
an encrypted redo log, there should be a redo log format version tag that
will prevent MySQL 5.7 or 8.0 from starting up.
2016-12-01 08:28:59 +02:00
Jan Lindström
dc9f919f27 MDEV-11005: Incorrect error message when using ONLINE alter table with GIS
Corrected error message when ONLINE alter table with GIS indexes is
used on InnoDB.
2016-12-01 06:42:59 +02:00
Daniel Black
6d1256973a MDEV-9872: crc32 initialization (innodb/xtradb)
Reorder logic as suggested by Svoj.

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-01 13:17:19 +11:00
Daniel Black
ba6af68c0f MDEV-9872: Generic CRC32 message using ptr
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2016-12-01 12:35:59 +11:00
Jan Lindström
3d0d290fde Remove tablespace code from InnoDB compilation as it is not used. 2016-11-30 17:53:30 +02:00
Alexey Botchkov
cc577f81b8 MDEV-11041 Innodb_gis/ tests taken from MySQL fail.
Some fixes made in innodb and item_create.cc.
        Adapted Innodb-GIS tests moved to MariaDB.
2016-11-29 16:25:22 +04:00
Marko Mäkelä
cc3aba26ff Merge branch '10.2_warnings' of https://github.com/kevgs/server into kevgs-10.2_warnings
Revert the XtraDB changes, because 10.2 does not currently build with XtraDB.

Also omit some changes that need further investigation.

Ensure that all callers of partition_info::get_clone() are passing this!=NULL.
2016-11-25 14:28:31 +02:00
Marko Mäkelä
d247d64988 MDEV-11349 (2/2) Fix some bogus-looking Valgrind warnings
buf_block_init(): Initialize buf_page_t::flush_type.
For some reason, Valgrind 3.12.0 would seem to flag some
bits in adjacent bitfields as uninitialized, even though only
the two bits of flush_type were left uninitialized. Initialize
the field to get rid of many warnings.

buf_page_init_low(): Initialize buf_page_t::old.
For some reason, Valgrind 3.12.0 would seem to flag all 32
bits uninitialized when buf_page_init_for_read() invokes
buf_LRU_add_block(bpage, TRUE). This would trigger bogus warnings
for buf_page_t::freed_page_clock being uninitialized.
(The V-bits would later claim that only "old" is initialized
in the 32-bit word.) Perhaps recent compilers
(GCC 6.2.1 and clang 4.0.0) generate more optimized x86_64 code
for bitfield operations, confusing Valgrind?

mach_write_to_1(), mach_write_to_2(), mach_write_to_3():
Rewrite the assertions that ensure that the most significant
bits are zero. Apparently, clang 4.0.0 would optimize expressions
of the form ((n | 0xFF) <= 0x100) to (n <= 0x100). The redundant
0xFF was added in the first place in order to suppress a
Valgrind warning. (Valgrind would warn about comparing uninitialized
values even in the case when the uninitialized bits do not affect
the result of the comparison.)
2016-11-25 12:43:43 +02:00
Marko Mäkelä
cdaa1d768e MDEV-11349 (1/2) Fix some clang 4.0 warnings
In functions that declare pointer parameters as nonnull,
remove nullness checks, because GCC would optimize them away anyway.

Use #ifdef instead of #if when checking for a configuration flag.

Clang says that left shifts of negative values are undefined.
So, use ~0U instead of ~0 in a number of macros.

Some functions that were defined as UNIV_INLINE were declared as
UNIV_INTERN. Consistently use the same type of linkage.

ibuf_merge_or_delete_for_page() could pass bitmap_page=NULL to
buf_page_print(), conflicting with the __attribute__((nonnull)).
2016-11-25 12:43:34 +02:00