Commit graph

182334 commits

Author SHA1 Message Date
Michael Widenius
be6ae0bb6b Don't report errors from open_table() twice 2018-05-14 10:08:05 +03:00
Michael Widenius
d853042b5f Added missing write_unlock() in case of errors 2018-05-14 10:08:04 +03:00
Marko Mäkelä
15419a5583 Merge 10.2 into 10.3 2018-05-12 22:14:59 +03:00
Marko Mäkelä
5e84ea9634 MDEV-12266: Remove dict_table_is_discarded()
The predicate dict_table_is_discarded() checks whether
ALTER TABLE…DISCARD TABLESPACE has been executed.

Replace most occurrences of dict_table_is_discarded() with
checks of dict_table_t::space. A few checks for the flag
DICT_TF2_DISCARDED are necessary; write them inline.

Because !is_readable() implies !space, some checks for
dict_table_is_discarded() were redundant.
2018-05-12 22:12:12 +03:00
Marko Mäkelä
c57e9835ff Replace dict_col_is_virtual(col) with col->is_virtual() 2018-05-12 22:12:12 +03:00
Marko Mäkelä
ba43914ec4 Replace dict_table_is_temporary(table) with table->is_temporary() 2018-05-12 22:12:12 +03:00
Sergei Golubchik
edaf57e966 disable galera.pxc-421 test 2018-05-12 17:36:28 +02:00
Eugene Kosov
f08b8fd58d MDEV-15980 FOR SYSTEM_TIME BETWEEN and FROM .. TO work with negative intervals
Fixed by using exactly the same filtering conditions as specified by standard
in 7.6 <table reference> General Rules
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
b1e75d290e MDEV-14823, MDEV-15956 Versioning error messages fixes
MDEV-14823 Wrong error message upon selecting from a system_time partition
MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
ce2cf855bf MDEV-16043 Assertion thd->Item_change_list::is_empty() failed in mysql_parse upon SELECT from a view reading from a versioned table
Lost restore_active_arena().
Using of Query_arena_stmt is suggested instead.
2018-05-12 10:16:46 +02:00
Sergei Golubchik
8b2fa0ab25 remove obsolete rdiff 2018-05-12 10:16:46 +02:00
Aleksey Midenkov
68cad6aa24 MDEV-16024 transaction_registry.begin_timestamp is wrong for explicit transactions
Store transaction start time in thd->transaction.start_time.
THD::transaction_time() wraps over transaction.start_time taking into
account current status of BEGIN.
2018-05-12 10:16:46 +02:00
Aleksey Midenkov
fd4153f083 MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL 2018-05-12 10:16:46 +02:00
Aleksey Midenkov
fddaaf7295 MDEV-15978 Add Feature_system_versioning status variable 2018-05-12 10:16:46 +02:00
Eugene Kosov
da25860d4a MDEV-15995 Drop extra semicolon in VARIABLE_COMMENT for SYSTEM_VERSIONING_ALTER_HISTORY 2018-05-12 10:16:46 +02:00
Eugene Kosov
fe10bf870c MDEV-15893 Rename VTQ to TRT 2018-05-12 10:16:46 +02:00
Sergei Golubchik
a4272bf154 versioning: use @@timestamp
Don't use hidden system time in versioning,
but keep the system time logic in THD
to workaround low-res system clock and
replication not versioned to versioned.

This reverts MDEV-14788 (System versioning cannot
be based on local timestamps, as it is now).
Versioning is based on local timestamps again,
but timestamps are protected by MDEV-15923
(option to control who can set session @@timestamp).
2018-05-12 10:16:46 +02:00
Sergei Golubchik
4203f572ae MDEV-15923 option to control who can set session @@timestamp
--secure-timestamp=NO|SUPER|REPLICATION|YES
2018-05-12 10:16:45 +02:00
Sergei Golubchik
bbf5cf4ddf cleanup: sys_vars.cc
remove the redundant declaration tail
2018-05-12 10:16:45 +02:00
Sergei Golubchik
735203e6de cleanup: quoted_string 2018-05-12 10:16:45 +02:00
Sergei Golubchik
47573cee4d cleanup: include/have_rbr_triggers.inc
this is always enabled now,
no need for a conditional
2018-05-12 10:16:45 +02:00
Sergei Golubchik
7bf39888f7 CONNECT: remove an outdated declaration 2018-05-12 10:16:45 +02:00
Sergei Golubchik
b1a6d2826a cleanup: versioning style fixes
rename LString/XString classes, remove unused ones
2018-05-12 10:16:45 +02:00
Sergei Golubchik
531acda484 MDEV-14820 System versioning is applied incorrectly to CTEs
Make sure that SELECT_LEX_UNIT::derived, behaves as documented
(points to the "TABLE_LIST representing this union in the
embedding select"). For recursive CTE this was not necessarily
the case, it could've pointed to the TABLE_LIST inside the CTE,
not in the embedding select.

To fix:
* don't update unit->derived in mysql_derived_prepare(), pass derived
  as an argument to st_select_lex_unit::prepare()
* prefer to set unit->derived in TABLE_LIST::init_derived()
  to the TABLE_LIST in the embedding select, not to the recursive
  reference. Fail if there are many TABLE_LISTs in the embedding
  select with conflicting FOR SYSTEM_TIME clauses.

cleanup:
* remove redundant THD* argument from st_select_lex_unit::prepare()
2018-05-12 10:16:45 +02:00
Sergei Golubchik
0f956a0676 cleanup: hide HA_ERR_RECORD_DELETED in ha_rnd_next()
it's internal storage engine error, don't let it leak
into the upper layer.
2018-05-12 10:16:45 +02:00
Sergei Golubchik
5441bbd3b1 ./mtr --gdb testname
Make --gdb to take an optional argument *only* if it's
written after '=', not after a space.

followup for 339b905579
2018-05-12 10:16:45 +02:00
Sergei Golubchik
0a1c0a439a compilation warnings w/o partitioning 2018-05-12 10:16:45 +02:00
Marko Mäkelä
77867c147b dict_create_index_tree_in_mem(): Remove dead code
In InnoDB, CREATE TEMPORARY TABLE does not allow FULLTEXT INDEX.
Replace a condition with a debug assertion, and add a test.
2018-05-12 10:28:54 +03:00
Marko Mäkelä
8c4f3b316e After-merge fix 2018-05-12 10:27:19 +03:00
Marko Mäkelä
9b18f5a5da MDEV-16142 Merge new release of InnoDB MySQL 5.7.22 to 10.2 2018-05-11 19:11:12 +03:00
Sachin Agarwal
0da98472b7 Bug #23593654 CRASH IN BUF_BLOCK_FROM_AHI WHEN LARGE PAGES AND AHI ARE ENABLED
Problem:

Fix for Bug #21348684 (#Rb9581) introduced a conditional debug execute
'buf_pool_resize_chunk_null', which causes new chunks memory for 2nd
buffer pool instance is freed.

Buffer pool resize function removes all old chunks entry from
'buf_chunk_map_reg' and add new chunks entry into it. But when
'buf_pool_resize_chunk_null' is set true, 2nd buffer pool
instance's chunk entries are not added into 'buf_chunk_map_reg'.
When purge thread tries to access that buffer chunk, it leads to
debug assertion.

Fix:

Added old chunk entries into 'buf_chunk_map_reg' for 2nd buffer pool
instance when 'buf_pool_resize_chunk_null' debug condition is set to true.

Reviewed by: Jimmy <Jimmy.Yang@oracle.com>
RB: 18664
2018-05-11 19:10:32 +03:00
Aakanksha Verma
4c7ea34ef6 FOLLOW-UP FIX FOR BUG#27141613
PROBLEM

Issue found during ntest run is a regression of  Bug #27141613. The
issue is basically when index is being freed due to an error during its
creation,when the index isn't added to dictionary cache its field
columns are not set, the derefrencing of null col pointer during the
clean of index from the virtual column's leads to a crash.

NOTE: Also test i_innodb.virtual_debug was failing on 32k page size and
above for the newly added scenario. Fixed that.

FIX

Added a check that if only the index is cached , the virtual index
freeing from the virtual cols index list is performed.

Reviewed by: Satya Bodapati<satya.bodapati@oracle.com>
RB: 18670
2018-05-11 19:10:32 +03:00
Aakanksha Verma
279f992b85 Bug #27141613 ASSERTION: TRX0REC.CC:319:COL->IS_VIRTUAL() / CRASH IN TRX_UNDO_READ_V_COLS
PROBLEM
=======
When add of virtual index fails with DB_TOO_BIG_RECORD , the virtual
index being freed isn't removed from the list of indexes a virtual
column(which is part of the index). This while the undo log is read
could fetch a wrong value during rollback and cause the assertion
reported in the bug particularly.

FIX
===
Added a function that is called when the virtual index being freed would
allow the index be removed from the index list of virtual column which
was a field of that index.

Reviwed By: Jimmy Yang<Jimmy.Yang@oracle.com>
RB: 18528
2018-05-11 19:10:32 +03:00
Marko Mäkelä
c88ac735b1 Adjust the test case for MariaDB 2018-05-11 19:10:32 +03:00
Aditya A
280879ebd9 Bug #27304661 MYSQL CRASH DOING SYNC INDEX ] [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600
PROBLEM
-------

Whenever an fts table is created it registers itself in a queue which
is operated by a background thread whose job is to optimize the
fts tables in background. Additionally we place these fts tables in
non-LRU list so that they cannot be evicted from cache. But in the
scenario when a node is brought up which is already having fts
tables ,we first try to load the fts tables in dictionary ,but we skip
the part where it is added in background queue and in non-LRU list because
the background thread is not yet created,so these tables are loaded
but they can be evicted from the cache. Now coming to the deadlock scenario

1. A Server background thread is trying to evict a table from the cache
    because the cache is full,so it scans the LRU list for the tables it can
    evict.It finds the fts table (because of the reason explained above)
    can be evicted and it takes the dict_sys->mutex (this is a system wide mutex)
    submits a request to  the background thread to remove this table from queue
    and waits it to be completed.

2.  In the mean time fts_optimize_thread() is processing another job
    in the queue and needs dict_sys->mutex for a small amount of time,
    but it cannot get it because it is blocked by the first background thread.

So Thread 1 is waiting for its job to be completed by Thread 2,whereas Thread 2
is waiting for dict_sys->mutex held by thread 1 ,causing the deadlock.

FIX
2018-05-11 19:10:32 +03:00
Sachin Agarwal
b7e333f98a Bug #26805833 INNODB COMPLAINS OF SYNTAX ERROR, BUT DOES NOT SAY WHICH OPTION
Problem:

when incorrect value is assigned to innodb_data_file_path or
innodb_temp_data_file_path parameter, Innodb returns error and logs error
message in mysqlds.err file but there is no information in error message about
the parameter which causes Innodb initialization is failed.

Fix:

Added error message with parameter name and value, which causes Innodb
initialization is failed.

Reviewed by: Jimmy <Jimmy.Yang@oracle.com>
RB: 18206
2018-05-11 19:10:32 +03:00
Sergey Vojtovich
c982924242 MDEV-15592 - Column COMPRESSED should select a 'high order' datatype
Compressed blob columns didn't accept data at their capacity. E.g. storing
255 bytes to TINYBLOB results in "Data too long" error.

Now it is allowed assuming compression method was able to produce shorter
string (so that both metadata and compressed data fits blob) and
column_compression_threshold is lower than blob.

If no compression was performed, we still have to reserve additional byte
for metadata and thus we perform normal data truncation and return it's
status.
2018-05-11 19:57:07 +04:00
Marko Mäkelä
671a37f60e Adjust the test case for MariaDB
Note: it does not appear to cover the bug fix! The test
will pass even if the Oracle Bug #26731689 fix is reverted.
2018-05-11 18:35:03 +03:00
Sachin Agarwal
3d10966b7d Bug #26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF
Problem:

During ALTER, when filling stored column info, wrong column number is used.
This is because we ignored virtual column when iterating over columns in
table and lead to debug assertion.

Fix:

In InnoDB table cache object, vcols are on stored on one list, stored and
normal columns are stored in another list.
When looking for stored column, ignore the virtual columns to get the right
column number of stored column.

Reviewed by: Thiru <thirunarayanan.balathandayuth@oracle.com>,
             Satya <satya.bodapati@oracle.com>
RB: 17939
2018-05-11 18:35:03 +03:00
Marko Mäkelä
e26b07dbc6 Add a test case for a MySQL 5.7 bug that did not affect MariaDB 2018-05-11 18:35:03 +03:00
Marko Mäkelä
82f0dc35aa Merge 10.1 into 10.2 2018-05-11 18:33:58 +03:00
Marko Mäkelä
c407ee0976 MDEV-16145 Crash in ALTER TABLE…AUTO_INCREMENT=1 after DISCARD TABLESPACE
This is the MariaDB equivalent of fixing the MySQL 5.7 regression
Bug #26935001 ALTER TABLE AUTO_INCREMENT TRIES TO READ
INDEX FROM DISCARDED TABLESPACE

Oracle did not publish a test case, but it is easy to guess
based on the commit message. The MariaDB code is different
due to MDEV-6076 implementing persistent AUTO_INCREMENT.

commit_set_autoinc(): Report ER_TABLESPACE_DISCARDED if the
tablespace is missing.

prepare_inplace_alter_table_dict(): Avoid accessing a discarded
tablespace. (This avoids generating warnings in fil_space_acquire().)
2018-05-11 18:30:14 +03:00
Marko Mäkelä
64f4576be4 MDEV-15697 post-fix: Remove an unused variable 2018-05-11 18:09:05 +03:00
Marko Mäkelä
3b99a274a8 Merge 10.0 into 10.1 2018-05-11 17:32:20 +03:00
Sachin Agarwal
197bf0fe35 Bug #26334149 - MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE ORPHANED DUE TO RENAME TABLE
Problem:
When FTS index is added into a table which doesn't have 'FTS_DOC_ID'
column, Innodb rebuilds table to add column 'FTS_DOC_ID'. when this FTS
index is dropped from this table. Innodb doesn't not rebuild table to
remove 'FTS_DOC_ID' column and deletes FTS index auxiliary tables.
But it doesn't delete FTS common auxiliary tables.
Later when the database having this table is renamed, FTS auxiliary
tables are not renamed because table's flags2 (dict_table_t.flags2)
has been resetted for DICT_TF2_FTS flag during FTS index drop operation.
Now when we drop old database, it leads to an assert.

Fix:
During renaming of FTS auxiliary tables, ORed a condition to check if
table has DICT_TF2_FTS_HAS_DOC_ID flag set.

RB: 18769
Reviewed by : Jimmy.Yang@oracle.com
2018-05-11 17:26:40 +03:00
twocode
8ad12b6664 User _server_host per discussion. 2018-05-11 16:24:55 +02:00
Xiangyu Hu
ee8dfc688e Add host name to session attributes. 2018-05-11 16:24:55 +02:00
Alexander Barkov
4a126bf3e1 Removing some duplicate code in THD::convert_string() & friends
1. Adding THD::convert_string(LEX_CSTRING *to,...) as a wrapper
   for convert_string(LEX_STRING *to,...), as LEX_CSTRING
   is now frequently used for conversion purpose.
   This reduced duplicate code in TEXT_STRING_sys,
   TEXT_STRING_literal, TEXT_STRING_filesystem grammar rules in *.yy

2. Adding yet another THD::convert_string() with an extra parameter
   "bool simple_copy_is_possible". This even more reduced
   repeatable code in the mentioned grammar rules in *.yy

3. Deriving Lex_ident_cli_st from Lex_string_with_metadata_st,
   as they have very similar functionality. Moving m_quote
   from Lex_ident_cli_st to Lex_string_with_metadata_st,
   as m_quote will be used later to optimize string literals anyway
   (e.g. avoid redundant copying on the tokenizer stage).
   Adjusting Lex_input_stream::get_text() accordingly.

4. Moving the reminders of the code in TEXT_STRING_sys, TEXT_STRING_literal,
   TEXT_STRING_filesystem grammar rules as new methods in THD:
   - make_text_string_sys()
   - make_text_string_connection()
   - make_text_string_filesystem()
   and changing *.yy to use these new methods.
   This reduced the amount of similar code in
   sql_yacc.yy and sql_yacc_ora.yy.

5. Removing duplicate code in Lex_input_stream::body_utf8_append_ident():
   by reusing THD::make_text_string_sys(). Thanks to #3 and #4.

6. Making THD members charset_is_system_charset,
   charset_is_collation_connection, charset_is_character_set_filesystem
   private, as they are not needed externally any more.
2018-05-11 18:02:16 +04:00
Thirunarayanan Balathandayuthapani
9c03ba8f0d Bug #27041445 SERVER ABORTS IF FTS_DOC_ID EXCEEDS FTS_DOC_ID_MAX_STEP
Problem:
=======
Multiple insert statement in table contains FULLTEXT KEY and a
FTS_DOC_ID column aborts the server if the FTS_DOC_ID exceeds
FTS_DOC_ID_MAX_STEP.

Solution:
========
Remove the exception for first committed insert statement.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 18023
2018-05-11 15:52:45 +03:00
Sergei Golubchik
af682525a8 compiler warning
item->val_int() == bool
2018-05-11 13:15:47 +02:00