Commit graph

11635 commits

Author SHA1 Message Date
Sergei Golubchik
1a0b986e78 MDEV-14764 Confusing error message: Table t1 must have at least one temporal column
compiler warning (mix of bool and enum in ?:)
2018-01-09 13:56:31 +03:00
Jan Lindström
07aa985979 MDEV-14776: InnoDB Monitor output generated by specific error is flooding error logs
innodb/buf_LRU_get_free_block
	Add debug instrumentation to produce error message about
	no free pages. Print error message only once and do not
	enable innodb monitor.

xtradb/buf_LRU_get_free_block
	Add debug instrumentation to produce error message about
	no free pages. Print error message only once and do not
	enable innodb monitor. Remove code that does not seem to
	be used.

innodb-lru-force-no-free-page.test
	New test case to force produce desired error message.
2018-01-09 12:48:31 +02:00
Marko Mäkelä
5208e89807 Merge 10.1 into 10.2 2018-01-08 17:21:23 +02:00
Marko Mäkelä
18ccbf014a Make the MDEV-14874 test case more robust 2018-01-08 17:09:21 +02:00
Marko Mäkelä
d8eef0f611 Merge 10.1 into 10.2 2018-01-08 16:49:31 +02:00
Marko Mäkelä
29b6e809a9 Merge 10.0 into 10.1 2018-01-08 14:51:20 +02:00
Marko Mäkelä
c903ba2f1e MDEV-13205 InnoDB: Failing assertion: !dict_index_is_online_ddl(index) upon ALTER TABLE
dict_foreign_find_index(): Ignore incompletely created indexes.
After a failed ADD UNIQUE INDEX, an incompletely created index
could be left behind until the next ALTER TABLE statement.
2018-01-08 14:26:55 +02:00
Eugene Kosov
5dddbafa4e
MDEV-14821 Assertion !is_set() || (m_status == DA_OK_BULK && is_bulk_op()) failed in Diagnostics_area::set_ok_status 2018-01-08 13:32:02 +03:00
Jan Lindström
ae7e1b9b13 MDEV-13262: innodb.deadlock_detect failed in buildbot
There is a race condition on a test. con1 is the older transaction
as it query started wait first. Test continues so that con1 gets
lock wait timeout first. There is possibility that default connection
gets lock timeout also or as con1 is rolled back it gets the locks
it waited and does the update. Fixed by removing query outputs as
they could vary and accepting success from default connection
query.
2018-01-08 12:25:31 +02:00
Marko Mäkelä
9ede569260 Merge 10.1 into 10.2 2018-01-08 09:54:40 +02:00
Marko Mäkelä
16d308e21d MDEV-14874 innodb_encrypt_log corrupts the log when the LSN crosses 32-bit boundary
This bug affects both writing and reading encrypted redo log in
MariaDB 10.1, starting from version 10.1.3 which added support for
innodb_encrypt_log. That is, InnoDB crash recovery and Mariabackup
will sometimes fail when innodb_encrypt_log is used.

MariaDB 10.2 or Mariabackup 10.2 or later versions are not affected.

log_block_get_start_lsn(): Remove. This function would cause trouble if
a log segment that is being read is crossing a 32-bit boundary of the LSN,
because this function does not allow the most significant 32 bits of the
LSN to change.

log_blocks_crypt(), log_encrypt_before_write(), log_decrypt_after_read():
Add the parameter "lsn" for the start LSN of the block.

log_blocks_encrypt(): Remove (unused function).
2018-01-08 09:44:40 +02:00
Aleksey Midenkov
912769b7dc SQL: lower priority of warning in vers_part_rotate() for ALTER [fixes #446] 2018-01-06 11:56:51 +03:00
Marko Mäkelä
fa7d85bb87 Merge bb-10.2-ext into 10.3 2018-01-05 22:52:06 +02:00
Monty
e9a2082634 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
	mysql-test/r/cte_nonrecursive.result
	mysql-test/suite/galera/r/galera_bf_abort.result
	mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
	mysql-test/suite/galera/r/galera_bf_abort_sleep.result
	mysql-test/suite/galera/r/galera_enum.result
	mysql-test/suite/galera/r/galera_fk_conflict.result
	mysql-test/suite/galera/r/galera_insert_multi.result
	mysql-test/suite/galera/r/galera_many_indexes.result
	mysql-test/suite/galera/r/galera_mdl_race.result
	mysql-test/suite/galera/r/galera_nopk_bit.result
	mysql-test/suite/galera/r/galera_nopk_blob.result
	mysql-test/suite/galera/r/galera_nopk_large_varchar.result
	mysql-test/suite/galera/r/galera_nopk_unicode.result
	mysql-test/suite/galera/r/galera_pk_bigint_signed.result
	mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
	mysql-test/suite/galera/r/galera_serializable.result
	mysql-test/suite/galera/r/galera_toi_drop_database.result
	mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
	mysql-test/suite/galera/r/galera_toi_truncate.result
	mysql-test/suite/galera/r/galera_unicode_pk.result
	mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
	mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
	sql/field.cc
	sql/rpl_gtid.cc
	sql/share/errmsg-utf8.txt
	sql/sql_acl.cc
	sql/sql_parse.cc
	sql/sql_partition_admin.cc
	sql/sql_prepare.cc
	sql/sql_repl.cc
	sql/sql_table.cc
	sql/sql_yacc.yy
2018-01-05 16:52:40 +02:00
Marko Mäkelä
287d105398 Merge 10.1 into 10.2 2018-01-05 12:11:58 +02:00
Marko Mäkelä
9c9db1cbe2 MDEV-14059 Work around a problem exposed by InnoDB GIS debug check
row_sel_get_clust_rec_for_mysql(): Look up the page from the
buffer pool, similar to how MySQL 5.7 does it.
2018-01-05 12:10:16 +02:00
Aleksey Midenkov
d9e0c06b5d Tests: detect table count for some encryption tests
debug_key_management
encrypt_and_grep
innodb_encryption

If real table count is different from what is expected by the test, it
just hangs on waiting to fulfill hardcoded number. And then exits with
**failed** after 10 minutes of wait: quite unfriendly and hard to
figure out what's going on.
2018-01-05 10:31:11 +02:00
Marko Mäkelä
8dc77a72ea MDEV-14057 InnoDB GIS tests fail
Fix and enable some of the tests; some remain disabled.

The tests innodb_gis.rtree_old and innodb_gis.row_format
duplicated some versions of the test main.gis-rtree.
Instead of duplicating, source that test, in a new test
innodb_gis.innodb_gis_rtree.

Introduce innodb_row_format.combinations. Due to this,
ROW_FORMAT=COMPRESSED will not be covered in some tests
where it is covered in MySQL 5.7.
2018-01-04 19:46:23 +02:00
Marko Mäkelä
218dbf68b8 MDEV-14058 InnoDB Assertion failure !leaf on rem0rec.cc line 566 on test innodb_gis.rtree_recovery
The function rtr_update_mbr_field_in_place() is generating
MLOG_REC_UPDATE_IN_PLACE or MLOG_COMP_REC_UPDATE_IN_PLACE records
on non-leaf pages, even though MLOG_WRITE_STRING would perfectly
suffice for updating a fixed-length data field.

btr_cur_parse_update_in_place(): If flags==7, the record may be
from rtr_update_mbr_field_in_place(), and we must check if the
page is a leaf page. Otherwise, assume that it is.

btr_cur_update_in_place(): Assert that the page is a leaf page.
2018-01-04 19:35:53 +02:00
Monty
5e0b13d173 Fixed wrong arguments to printf and related functions
Other things, mainly to get
create_mysqld_error_find_printf_error tool to work:

- Added protection to not include mysqld_error.h twice
- Include "unireg.h" instead of "mysqld_error.h" in server
- Added protection if ER_XX messages are already defined
- Removed wrong calls to my_error(ER_OUTOFMEMORY) as
  my_malloc() and my_alloc will do this automatically
- Added missing %s to ER_DUP_QUERY_NAME
- Removed old and wrong calls to my_strerror() when using
  MY_ERROR_ON_RENAME (wrong merge)
- Fixed deadlock error message from Galera. Before the extra
  information given to ER_LOCK_DEADLOCK was missing because
  ER_LOCK_DEADLOCK doesn't provide any extra information.

I kept #ifdef mysqld_error_find_printf_error_used in sql_acl.h
to make it easy to do this kind of check again in the future
2018-01-04 16:24:09 +02:00
Aleksey Midenkov
64afa5be1c Tests: detect table count for some encryption tests
debug_key_management
encrypt_and_grep
innodb_encryption

If real table count is different from what is expected by the test, it
just hangs on waiting to fulfill hardcoded number. And then exits with
**failed** after 10 minutes of wait: quite unfriendly and hard to
figure out what's going on.
2018-01-04 16:30:18 +03:00
Marko Mäkelä
145ae15a33 Merge bb-10.2-ext into 10.3 2018-01-04 09:22:59 +02:00
Marko Mäkelä
acd2862e65 MDEV-14848 MariaDB 10.3 refuses InnoDB crash-upgrade from MariaDB 10.2
While the redo log format was changed in MariaDB 10.3.2 and 10.3.3
due to MDEV-12288 and MDEV-11369, it should be technically possible
to upgrade from a crashed MariaDB 10.2 instance.

On a related note, it should be possible for Mariabackup 10.3
to create a backup from a running MariaDB Server 10.2.

mlog_id_t: Put back the 10.2 specific redo log record types
MLOG_UNDO_INSERT, MLOG_UNDO_ERASE_END, MLOG_UNDO_INIT,
MLOG_UNDO_HDR_REUSE.

trx_undo_parse_add_undo_rec(): Parse or apply MLOG_UNDO_INSERT.

trx_undo_erase_page_end(): Apply MLOG_UNDO_ERASE_END.

trx_undo_parse_page_init(): Parse or apply MLOG_UNDO_INIT.

trx_undo_parse_page_header_reuse(): Parse or apply MLOG_UNDO_HDR_REUSE.

recv_log_recover_10_2(): Remove. Always parse the redo log from 10.2.

recv_find_max_checkpoint(), recv_recovery_from_checkpoint_start():
Always parse the redo log from MariaDB 10.2.

recv_parse_or_apply_log_rec_body(): Parse or apply
MLOG_UNDO_INSERT, MLOG_UNDO_ERASE_END, MLOG_UNDO_INIT.

srv_prepare_to_delete_redo_log_files(),
innobase_start_or_create_for_mysql(): Upgrade from a previous (supported)
redo log format.
2018-01-03 19:08:50 +02:00
Marko Mäkelä
f7fd6ace18 Merge 10.2 into bb-10.2-ext 2018-01-03 15:48:47 +02:00
Eugene Kosov
dbf21ff396
MDEV-14787 CREATE does not allow tables with versioning columns only, but ALTER does 2018-01-03 15:51:23 +03:00
Marko Mäkelä
d361401bc2 Merge 10.1 into 10.2, with some MDEV-14799 fixups
trx_undo_page_report_modify(): For SPATIAL INDEX, keep logging
updated off-page columns twice, so that
the minimum bounding rectangle (MBR) will be logged.
Avoiding the redundant logging would require larger changes
to the undo log format.

row_build_index_entry_low(): Handle SPATIAL_UNKNOWN more robustly,
by refusing to purge the record from the spatial index.
We can get this code when processing old undo log from 10.2.10 or
10.2.11 (the releases affected by MDEV-14799, which was a regression
from MDEV-14051).
2018-01-03 11:56:24 +02:00
Marko Mäkelä
7a9fee9853 MDEV-13568 gcol.innodb_virtual_debug_purge failed in buildbot with wrong result
The InnoDB background tasks can modify tables while LOCK TABLES...WRITE
is in effect. The purge of InnoDB history always worked like this in
MariaDB, but in MySQL 5.7 it sometimes yields to LOCK TABLES.

Also, make gcol.innodb_virtual_index run the purge for an UPDATE
before DROP TABLE is executed.
2018-01-03 11:39:17 +02:00
Monty
c2c2173727 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2018-01-03 02:59:32 +02:00
Monty
36ba58cb75 Fixed that sequences and default works with ps-protocol
The bug was that for prepared statments the new TABLE_LIST was
allocated in the wrong arena.
2018-01-03 02:45:02 +02:00
Monty
6f28f78429 More output in galera.query_cache.test
This is to be able to better track where things goes wrong
2018-01-03 01:01:53 +02:00
Monty
22b4f469ca MDEV-14813 rpl.rpl_ctype_latin1 fails in buildbot on Mac with wrong result
Make rpl_ctype_latin1 more portable by printing names in hex
Also only run if lower_case_table_names is 0, as this affects the result
2018-01-03 01:01:53 +02:00
Marko Mäkelä
016caa3d20 Merge 10.0 into 10.1 2018-01-02 21:57:22 +02:00
Marko Mäkelä
51e4650ed0 Merge 5.5 into 10.0 2018-01-02 21:52:46 +02:00
Aleksey Midenkov
b8b5d8d87d MDEV-14828 Server crashes in JOIN::prepare / setup_fields on 2nd execution of PS [fixes #437] 2018-01-02 15:28:50 +03:00
Aleksey Midenkov
8efca72f4a MDEV-14792 INSERT without column list into table with explicit versioning columns produces bad data 2018-01-01 23:37:02 +03:00
Eugene Kosov
157150cfcf MDEV-14769 Temporary table can be altered into system versioning + system_versioning_alter_history has no effect 2018-01-01 23:37:02 +03:00
Aleksey Midenkov
7069071d7d MDEV-14786 Server crashes in Item_cond::transform on 2nd execution of SP querying from a view [fixes #436] 2018-01-01 23:34:39 +03:00
Monty
fbab79c9b8 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
	cmake/make_dist.cmake.in
	mysql-test/r/func_json.result
	mysql-test/r/ps.result
	mysql-test/t/func_json.test
	mysql-test/t/ps.test
	sql/item_cmpfunc.h
2018-01-01 19:39:59 +02:00
Monty
b32b22baba Disable warnings in partion_alter_myisam
Disabled warnings for directory option as this is depending on compilation
options.
2018-01-01 19:38:58 +02:00
Monty
7e882a60bf Ensure that table->vcol_set is properly restored if used
Code in QUICK_RANGE_SELECT::init_ror_merged_scan() could theoretically
have caused crashes if this was ever called from an update or delete

This also found a bug in the vcol/range.result. file.
2018-01-01 14:44:20 +02:00
Igor Babaev
4f0299f8b3 This is a full cost-based implementation of the optimization that employs
splitting technique for equi-joins of materialized derived tables/views/CTEs.
(see mdev-13369 and mdev-13389).
2017-12-30 12:29:09 -08:00
Monty
e64184134a mysqlbinlog now prints "# Number of rows" and stops on errors
Main problem was that no log-event print function checked for disk
full error on the IO_CACHE.
All changes in this patch only affects mysqlbinlog, not the server!

- Changed all log-event print functions to return 1 on error
- Fixed memory usage when not using --flashback.
- Added printing of number of rows in row events. Can be disabled with
  --print-row-count=0
- Print annotated rows when using mysqlbinlog --short-form
- Fixed that mysqlbinlog --debug works
- Fixed create_drop_binlog.test test failure
- Reorganized fields in PRINT_EVENT_INFO to be according to size to
  optimize storage
- Don't change print_row_event_position or print_row_counts if set by user
- Remove some testing of argument to my_free is 0
- base64-output=never is now supported and works in all context
- Updated help information for --base64-output and --short-form
- print_row_count is now on by default. Reset automatically if --short-form
  is used
- Removed obsolote warning for mysql 5.6.0
- More DBUG_PRINT for mysqltest.cc
- my_b_write_byte() now checks for flush failures. This fixed a memory
  overrun on disk full
- my_b_printf() now returns 1 on failure, 0 on ok.  This simplifies code
  and no old code was using the old return value of my_b_printf().
- my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok
- Fixed some error conditions in log printing that was not previously
  handled.
- Slave_rows_error_report() can now handle longlong positions
- Write_on_release_cache() rewritten so that we can detect errors
  on flush. Not depending on automatic release anymore.
- Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS
- Fixed that copy_event_cache_to_string_and_reinit() works with strings
  longer than 4G (Changed to use LEX_STRING instead of String)
- Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are
  anyway restricted to UINT32_MAX
- Fixed bug in rpl_binlog_state::write_to_iocache() which hide write
  failures (duplicate variable name)
- Fixed bug in String::append if original string was not allocated
- Stop mysqlbinlog output at once if there is an error.
- Before printing error message, flush result file. This ensures that
  the error message is printed last. (Easier to find)
2017-12-29 13:35:41 +02:00
Vicențiu Ciorbaru
24774fba65 Update galera_gtid_slave result file post merge 2017-12-29 09:33:30 +02:00
Eugene Kosov
19f0b512a9 Tests: record mariabackup.system_versioning [#387] 2017-12-29 00:23:21 +03:00
Eugene Kosov
d72462a29b SQL: TRX_ID to TIMESTAMP versioning switch [fixes #428] 2017-12-29 00:23:20 +03:00
Aleksey Midenkov
d1e4c5d13e MDEV-14748 Assertion in ha_myisammrg::attach_children() [fixes #434] 2017-12-29 00:23:20 +03:00
Sergei Golubchik
9daf583ab6 fix CREATE ... SELECT
move table->vers_update_fields() where it belongs - into fill_record(),
right after table_arg->update_virtual_fields()
2017-12-29 00:23:13 +03:00
Sergei Golubchik
1a06a48230 Tests: ER_VERS_DUPLICATE_ROW_START_END check 2017-12-29 00:23:13 +03:00
Eugene Kosov
0fe67f2ef9 MDEV-14744 Assertion `table->versioned() == m_prebuilt->table->versioned()' failed in ha_innobase::open 2017-12-29 00:23:07 +03:00
Vicențiu Ciorbaru
8e9d8ffd1a Update main.innodb test result post-merge 2017-12-28 19:59:04 +02:00
Vicențiu Ciorbaru
9aeb5d01d6 Merge remote-tracking branch 'origin/10.1' into bb-10.2-vicentiu 2017-12-28 19:27:00 +02:00
Sergei Golubchik
7e4c185c77 MDEV-14272 Mariadb crashes with signal 11 when using federatedx engine and galera
cherry-pick e6ce97a592
2017-12-28 02:13:25 +01:00
Sergei Golubchik
1300627a5d MDEV-14309 MTR tests require perl-Env which is not always in the default installation
* don't use Env module in tests, use $ENV{xxx} instead
* collateral changes:
** $file in the error message was unset
** $file in the other error message was unset too :)
** source file arguments are conventionally upper-cased
** abort the test (die) on error, don't just echo/exit
2017-12-27 23:17:28 +01:00
Vicențiu Ciorbaru
d1c2cd30b7 Merge remote-tracking branch '10.0' into 10.1 2017-12-27 17:50:39 +02:00
Alexander Barkov
02b7dc7bec MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event. 2017-12-27 12:30:05 +04:00
Aleksey Midenkov
04451f0f8a MDEV-14765 Server crashes in Sys_var_vers_asof::update 2017-12-26 15:25:39 +03:00
Aleksey Midenkov
11c6882741 MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES 2017-12-26 15:25:39 +03:00
Aleksey Midenkov
4236f589b6 MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [fixes #431]
SQL: TABLE_LIST cleanup on free_tmp_table()

May affect non-versioning tests (main suite passed).
2017-12-26 15:25:39 +03:00
Sergei Golubchik
5377242fff MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options
set data_file_name and index_file_name in HA_CREATE_INFO
before calling check_if_incompatible_data()
2017-12-25 15:18:21 +01:00
Eugene Kosov
d8aabb44b5
SQL: prohibit ALTER ... AS ROW START|END [fixes #429] 2017-12-25 13:38:03 +03:00
Sachin Setiya
2fe6186124 MDEV-10715 Galera: Replicate MariaDB GTID to other nodes in the cluster
Problem:- Gtid are not transferred in Galera Cluster.

Solution:- We need to transfer gtid in the case on either when cluster is
slave/master in async replication. In normal Gtid replication gtid are generated on
recieving node itself and it is always on sync with other nodes. Because galera keeps
node in sync , So all nodes get same no of event groups. So the issue arises when
say galera is slave in async replication.
A
|    (Async replication)
D <-> E <-> F  {Galera replication}
So what should happen is that all node should apply the master gtid but this does
node happen, becuase node E, F does not recieve gtid from D in write set , So what E(or F)
does is that it applies wsrep_gtid_domain_id, D server-id , E gtid next seq no. This
generated gtid does not always work when say A has different domain id.

So In this commit, on galera node when we see that this event is recieved from master
we simply write Gtid_Log_Event in write_set and send it to other nodes.
2017-12-25 13:57:42 +05:30
Monty
d9e90292eb Fixed failures in innodb tests caused by not flushed restart
- Fixed innodb.recovery_shutdown.test
- Fixed innodb.instant_alter_rollback
2017-12-22 16:01:04 +02:00
Aleksey Midenkov
ea49441c41 Partition: uninitialized vers_info fix 2017-12-22 16:40:09 +03:00
Monty
9cc7789e90 MDEV 13679 Enabled sequences to be used in DEFAULT
Other changes done to get this to work:
- Added 'internal_tables' to TABLE object to list which sequence tables
  is needed to use the table.
- Mark any expression using DEFAULT() with LEX->default_used.
  This is needed when deciding if we should open internal sequence
  tables when a table is opened (we don't need to open sequence tables
  if the main table is only used with SELECT).
- Create_and_open_temporary_table() can now also open all internal
  sequence tables.
- Added option MYSQL_LOCK_USE_MALLOC to mysql_lock_tables()
  to force memory allocation to be used with malloc instead of
  memroot.
- Added flag to MYSQL_LOCK to remember if allocation was done with
  malloc or memroot (makes code simpler and safer).
- init_one_table_for_prelocking() now takes argument for what lock to
  use instead of it's a routine or something else.
- Renamed prelocking placeholders to make them more understandable as
  they are now used in more code.
- Changed test in check_lock_and_start_stmt() if found table has correct
  locks. The old test didn't work for tables that has lock
  TL_WRITE_ALLOW_WRITE, which is what sequence tables are using.
- Added VCOL_NOT_VIRTUAL option to ensure that sequence functions can't
  be used with virtual columns
- More sequence tests
2017-12-22 14:56:58 +02:00
Aleksey Midenkov
57f827cdd6 MDEV-14741 Assertion '(trx)->start_file == 0' failed
in row_truncate_table_for_mysql()
2017-12-22 14:52:17 +03:00
Vicențiu Ciorbaru
985d2d393c Merge remote-tracking branch 'origin/10.1' into 10.2 2017-12-22 12:23:39 +02:00
Sergey Vojtovich
4b8cd4536a MDEV-13626 Merge InnoDB test cases from MySQL 5.7
Coverage for temporary tables modifications in read-only transactions.
Introduced in 5.7 by 325cdf426
2017-12-22 14:03:25 +04:00
Aleksey Midenkov
1e8eae40ce MDEV-14740 Locking assertion for system_time partitioning
Assertion `thd->locked_tables_mode <= LTM_LOCK_TABLES ||
!thd->lex->requires_prelocking()' failed in lock_tables().
2017-12-22 12:51:48 +03:00
Sergei Golubchik
37f5569909 @@in_predicate_conversion_threshold
* rename in_subquery_conversion_threshold to in_predicate_conversion_threshold
* make it debug-only, hide from users
* change from ulong to uint - same type and range on all architectures
2017-12-21 23:36:00 +01:00
Eugene Kosov
d6b68b0e8d Tests: mariabackup.system_versioning [#387] 2017-12-21 21:15:20 +03:00
Marko Mäkelä
461cf3e5a3 Make a test more robust
Sometimes, the test would fail with a result difference for
the READ UNCOMMITTED read, because the incremental backup
would finish before redo log was written for all the rows
that were inserted in the second batch.

To fix that, cause a redo log write by creating another
transaction. The transaction rollback (which internally does commit)
will be flushed to the redo log, and before that, all the preceding
changes will be flushed to the redo log as well.
2017-12-21 17:40:01 +02:00
Marko Mäkelä
9d7c0882fa Merge 10.0 into 10.1 2017-12-21 17:25:51 +02:00
Marko Mäkelä
0202e47274 MDEV-12827 Assertion failure when reporting duplicate key error in online table rebuild
row_log_table_apply_insert_low(), row_log_table_apply_update():
When reporting the error_key_num, only count the clustered index
if it corresponds to a key in the SQL layer.

The assertion failure was probably introduced by the (incomplete)
MySQL 5.6.28 bug fix
Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL
WITH INCORRECT KEY NAME
which we are improving.

Side note: the fix was incorrectly merged to MySQL 5.7.10;
incorrect key names will continue to be reported in MySQL 5.7.
2017-12-21 17:19:13 +02:00
Aleksey Midenkov
7e39f70044 MDEV-14722 Partition: assertion in ha_commit_trans() for sub-statement 2017-12-21 16:15:56 +03:00
Aleksey Midenkov
e65a695f28 Tests: disabled embedded for versioning.trx_id [#387]
Error ER_VERS_TRT_IS_DISABLED is not thrown.
2017-12-21 15:08:34 +03:00
Eugene Kosov
aa4d1bedfc
MDEV-14689 Server crashes in find_field_in_tables on 2nd execution of PS with versioned table and view
SQL: wrong usage of Item::transform()
2017-12-21 14:59:46 +03:00
Eugene Kosov
6dc75b5f89
MDEV-14632 Assertion `!((new_col->prtype ^ col->prtype) & ~256U)' failed in row_log_table_apply_convert_mrec
ha_innobase::check_if_supported_inplace_alter(): enabled non-rebuilding operations for trx_id-based system-versioning tables

Also added better error message for not implemented operations.
2017-12-21 14:59:18 +03:00
Aleksey Midenkov
7880dc65f5 Tests: detect table count for some encryption tests
debug_key_management
encrypt_and_grep

Related to 62b44b0efa
2017-12-21 14:14:06 +03:00
Aleksey Midenkov
ba3e689c4d Tests: full test results [#387] 2017-12-21 14:14:05 +03:00
Aleksey Midenkov
fbbdd44f72 Tests: removed --transaction-registry option [#387]
1. Reverts "Tests: disabled TRT for some IB tests [#302]"
6d78496aee

2. Removes setting TRANSACTION_REGISTRY=0 in mysqldump

--system-versioning-transaction-registry now is OFF by default.

This commit should be reverted back if the default will change.

Tests affected: mysqldump mysqldump-max openssl_1
2017-12-21 12:51:57 +03:00
Aleksey Midenkov
5c0a19c873 System Versioning 1.0 pre7
Merge branch '10.3' into trunk
2017-12-21 11:16:42 +03:00
Aleksey Midenkov
5c760d952b Parser: default SYSTEM_TIME ALL for DELETE HISTORY 2017-12-21 10:48:48 +03:00
Aleksey Midenkov
36888cc531 MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [fixes #422] 2017-12-21 10:25:32 +03:00
Eugene Kosov
a04a283469
MDEV-14692 Server crash in MDL_ticket::has_stronger_or_equal_type
SQL: disable system-versioning stuff on TEMPORARY tables
2017-12-21 10:14:25 +03:00
Marko Mäkelä
9ec2479778 Merge bb-10.2-ext into 10.3 2017-12-21 08:36:02 +02:00
Marko Mäkelä
40f4525f43 MDEV-14585: Adjust the innodb.innodb-alter-tempfile test case 2017-12-21 08:20:31 +02:00
Marko Mäkelä
1ec8d45c4d Merge bb-10.2-ext into 10.3 2017-12-20 23:18:41 +02:00
Marko Mäkelä
69e88de0fe MDEV-14585: Adjust the innodb.alter_crash test case 2017-12-20 23:15:44 +02:00
Marko Mäkelä
2534b5cb99 Merge bb-10.2-ext into 10.3 2017-12-20 22:37:24 +02:00
Marko Mäkelä
0bc36758ba MDEV-14717 RENAME TABLE in InnoDB is not crash-safe
InnoDB in MariaDB 10.2 appears to only write MLOG_FILE_RENAME2
redo log records during table-rebuilding ALGORITHM=INPLACE operations.
We must write the records for any .ibd file renames, so that the
operations are crash-safe.

If InnoDB is killed during a RENAME TABLE operation, it can happen that
the transaction for updating the data dictionary will be rolled back.
But, nothing will roll back the renaming of the .ibd file
(the MLOG_FILE_RENAME2 only guarantees roll-forward), or for that matter,
the renaming of the dict_table_t::name in the dict_sys cache. We introduce
the undo log record TRX_UNDO_RENAME_TABLE to fix this.

fil_space_for_table_exists_in_mem(): Remove the parameters
adjust_space, table_id and some code that was trying to work around
these deficiencies.

fil_name_write_rename(): Write a MLOG_FILE_RENAME2 record.

dict_table_rename_in_cache(): Invoke fil_name_write_rename().

trx_undo_rec_copy(): Set the first 2 bytes to the length of the
copied undo log record.

trx_undo_page_report_rename(), trx_undo_report_rename():
Write a TRX_UNDO_RENAME_TABLE record with the old table name.

row_rename_table_for_mysql(): Invoke trx_undo_report_rename()
before modifying any data dictionary tables.

row_undo_ins_parse_undo_rec(): Roll back TRX_UNDO_RENAME_TABLE
by invoking dict_table_rename_in_cache(), which will take care
of both renaming the table and the file.
2017-12-20 22:21:03 +02:00
Eugene Kosov
acdfacee75
IB: TRT is not updated on ADD SYSTEM VERSIONING [fixes #413] 2017-12-20 22:46:28 +03:00
Eugene Kosov
4bc268d406
MDEV-14632 Assertion `!((new_col->prtype ^ col->prtype) & ~256U)' failed in row_log_table_apply_convert_mrec
SQL, IB: proper fix is to disable unimplemented Online DDL for system-versioned tables inside InnoDB
2017-12-20 19:42:15 +03:00
Eugene Kosov
b13f1cc59a
MDEV-14681 Bogus ER_UNSUPPORTED_EXTENSION 2017-12-20 16:41:42 +03:00
Aleksey Midenkov
7eff2080fd MDEV-14687 DELETE HISTORY in prepared stmt crash [fixes #421]
Also fixes broken truncate after 617e108fb6
2017-12-20 16:12:32 +03:00
Vicențiu Ciorbaru
e3d89652e5 Merge branch '10.0' into 10.1 2017-12-20 13:30:05 +02:00
Vicențiu Ciorbaru
042f763268 Merge remote-tracking branch '5.5' into 10.0 2017-12-20 12:51:57 +02:00
Alexander Barkov
cb121a047b An after-fix for MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
Fixing an additional failure discovered after a merge to 10.2
2017-12-20 13:49:27 +04:00
Alexander Barkov
c58df0cdd4 MDEV-14031 Password policy causes replication failure 2017-12-20 12:14:49 +04:00
Monty
b4e5d5e2db Updated result for alter_crash 2017-12-20 01:30:12 +02:00
Aleksey Midenkov
c5d0c38efc MDEV-14676 Redundancy in error codes
ER_VERS_NOT_VERSIONED vs ER_VERSIONING_REQUIRED
2017-12-19 22:05:25 +03:00
Aleksey Midenkov
fc21529f14 MDEV-14683 Possible redundancy in error codes
ER_VERS_GENERATED_ALWAYS_NOT_EMPTY vs ER_VERS_ALTER_SYSTEM_FIELD

Related to #310 (91ba4f04be).
2017-12-19 21:55:40 +03:00
Marko Mäkelä
0436a0ff3c Merge bb-10.2-ext into 10.3 2017-12-19 17:28:22 +02:00
Marko Mäkelä
88aff5f471 Follow-up to MDEV-13407 innodb.drop_table_background failed in buildbot with "Tablespace for table exists"
The InnoDB background DROP TABLE queue is something that we should
really remove, but are unable to until we remove dict_operation_lock
so that DDL and DML operations can be combined in a single transaction.

Because the queue is not persistent, it is not crash-safe. We should
in some way ensure that the deferred-dropped tables will be dropped
after server restart.

The existence of two separate transactions complicates the error handling
of CREATE TABLE...SELECT. We should really not break locks in DROP TABLE.

Our solution to these problems is to rename the table to a temporary
name, and to drop such-named tables on InnoDB startup. Also, the
queue will use table IDs instead of names from now on.

check-testcase.test: Ignore #sql-ib*.ibd files, because tables may enter
the background DROP TABLE queue shortly before the test finishes.

innodb.drop_table_background: Test CREATE...SELECT and the creation of
tables whose file name starts with #sql-ib.

innodb.alter_crash: Adjust the recovery, now that the #sql-ib tables
will be dropped on InnoDB startup.

row_mysql_drop_garbage_tables(): New function, to drop all #sql-ib tables
on InnoDB startup.

row_drop_table_for_mysql_in_background(): Remove an unnecessary and
misplaced call to log_buffer_flush_to_disk(). (The call should have been
after the transaction commit. We do not care about flushing the redo log
here, because the table would be dropped again at server startup.)

Remove the entry from the list after the table no longer exists.

If server shutdown has been initiated, empty the list without actually
dropping any tables. They will be dropped again on startup.

row_drop_table_for_mysql(): Do not call lock_remove_all_on_table().
Instead, if locks exist, defer the DROP TABLE until they do not exist.
If the table name does not start with #sql-ib, rename it to that prefix
before adding it to the background DROP TABLE queue.
2017-12-19 17:12:39 +02:00
Marko Mäkelä
028e91f380 Merge 10.2 into bb-10.2-ext 2017-12-19 17:12:14 +02:00
Marko Mäkelä
8d70097c21 Merge 10.1 to 10.2
Follow-up fix to MDEV-14008: Let Field_double::val_uint() silently
return 0 on error
2017-12-19 16:48:28 +02:00
Sergei Golubchik
617e108fb6 s/TRUNCATE ... TO/DELETE HISTORY FROM ... BEFORE/ 2017-12-19 16:35:38 +03:00
Aleksey Midenkov
ee68d019d1 SQL: removed VERS_HIDDEN_FLAG [closes #409] 2017-12-19 16:12:56 +03:00
Eugene Kosov
8ba06032ae
MDEV-14684 Assertion `table' failed in mysql_delete
SQL: disable TRUNCATE table_name TO statement for VIEWs
2017-12-19 15:12:11 +03:00
Vicențiu Ciorbaru
be758322e2 MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles
Whenever we call merge_role_privileges on a role, we make use of
the role->counter variable to check if all it's children have had their
privileges merged. Only if all children have had their privileges merged,
do we update the privileges on parent. This is done to prevent extra work.
The same idea is employed during flush privileges. You only begin merging
from "leaf" roles. The recursive calls will merge their parents at some point.
A problem arises when we try to "re-merge" a parent. Take the following graph:

{noformat}
     A (0)  ----  C (2) ---- D (2)  ---- USER
                 /          /
     B (0)  ----/          /
                          /
     E (0) --------------/
{noformat}

In parentheses we have the "counter" value right before we start to iterate
through the roles hash and propagate values. It represents the number of roles
granted to the current role. The order in which we iterate through the roles
hash is alphabetical.

* First merge A, which leads to decreasing the counter for C to 1. Since C is
not 0, we don't proceed with merging into C.

* Second we merge B, which leads to decreasing the counter for C to 0. Now
we proceed with merging into C. This leads to reducing the counter for D to 1
as part of C merge process.

* Third as we iterate through the hash, we see that C has counter 0, thus we
start the merge process *again*. This leads to reducing the counter for
D to 0! We then attempt to merge D.

* Fourth we start merging E. When E sees D as it's parent (according to the code)
it attempts to reduce D's counter, which leads to overflow. Now D's counter is
a very large number, thus E's privileges are not forwarded to D yet.

To correct this behavior we must make sure to only start merging from initial
leaf nodes.
2017-12-19 12:33:25 +02:00
Vicențiu Ciorbaru
2fced9e7b6 MDEV-13655: Set role does not properly grant privileges.
When granting a role to another role, DB privileges get propagated. If
the grantee had no previous DB privileges, an extra ACL_DB entry is created to
house those "indirectly received" privileges. If, afterwards, DB
privileges are granted to the grantee directly, we must make sure to not
create a duplicate ACL_DB entry.
2017-12-19 12:33:25 +02:00
Eugene Kosov
22f2b39c14 fix data races in rwlock 2017-12-19 13:03:04 +04:00
Andrei Elkin
ca9ed393ef MDEV-13073. rpl.perf_buildin_semisync_issue40 is corrected to expect the Rpl_semi_sync_master_clients value of 1 (ll.307..). Explicit sleeps are converted to wait_xyz. 2017-12-18 22:59:05 +02:00
Aleksey Midenkov
04bed58acf SQL: partitioning CREATE, ALTER fixes
MDEV-14688 Assertion `tab_part_info->part_type == LIST_PARTITION' failed in prep_alter_part_table
MDEV-14673 Assertion `part_elem->type() == partition_element::AS_OF_NOW' failed in check_partition_info
2017-12-18 22:17:53 +03:00
Aleksey Midenkov
b0d9dc43ca SQL: system_versioning_transaction_registry default OFF 2017-12-18 22:17:52 +03:00
Marko Mäkelä
09c5bbf471 Merge 10.0 into 10.1 2017-12-18 20:05:50 +02:00
Aleksey Midenkov
82379ce14d SQL: error messages revised 2017-12-18 19:11:54 +03:00
Aleksey Midenkov
b55a149194
Timestamp-based versioning for InnoDB [closes #209]
* Removed integer_fields check
* Reworked Vers_parse_info::check_sys_fields()
* Misc renames
* versioned as vers_sys_type_t

* Removed versioned_by_sql(), versioned_by_engine()

versioned() works as before;
versioned(VERS_TIMESTAMP) is versioned_by_sql();
versioned(VERS_TRX_ID) is versioned_by_engine().

* create_tmp_table() fix
* Foreign constraints for timestamp-based
* Range auto-specifier fix
* SQL: 1-row partition rotation fix [fixes #260]
* Fix 'drop system versioning, algorithm=inplace'
2017-12-18 19:03:51 +03:00
Sergei Golubchik
03e91ce324 MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
make sure that mysql_create_frm_image() and fast_alter_partition_table()
use the same code to derive HA_OPTION_PACK_RECORD from
create_info->row_type.
2017-12-18 16:16:42 +01:00
Andrei Elkin
f279d3c43a MDEV-13073. This part converts the Ali patch`s identifiers to the MariaDB standard. Also some renaming is done as well as white spaces removal. 2017-12-18 13:43:38 +02:00
Andrei Elkin
c0ea3056b6 MDEV-13073. This is a part with a new test (refined Ali's
one) and affected result files.

Specifically to rpl_semi_sync_after_sync*, the changed results reflect
a fact that thanks to fixes in the dump thread functionality
there's no longer zombie thread to kill neither such thread represent
a semisync client (so the counter drops).
2017-12-18 13:43:37 +02:00
Andrei Elkin
74b35b6874 MDEV-13073. This part patch weeds out RUN_HOOK from the server as semisync
is defined statically. Consequently the observer interfaces are removed
as well.
2017-12-18 13:43:37 +02:00
Andrei Elkin
e972125f11 MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality.
Semisync is turned to be static instead of plugin so its functions
are invoked at the same points as RUN_HOOKS.
The RUN_HOOKS and the observer interface remain to be removed by later
patch.

Todo:
  React on killed status by repl_semisync_master.wait_after_sync(). Currently
  Repl_semi_sync_master::commit_trx does not check the killed status.

  There were few bugfixes found that are present in mysql and its unclear
  whether/how they are covered. Those include:

  Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS
  Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL
                 HAS BAD PERFORMANCE
  Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
2017-12-18 13:43:37 +02:00
Monty
13770edbcb Changed from using LOCK_log to LOCK_binlog_end_pos for binary log
Part of MDEV-13073 AliSQL Optimize performance of semisync

The idea it to use a dedicated lock detecting if there is new data in
the master's binary log instead of the overused LOCK_log.

Changes:
- Use dedicated COND variables for the relay and binary log signaling.
  This was needed as we where the old 'update_cond' variable was used
  with different mutex's, which could cause deadlocks.
   - Relay log uses now COND_relay_log_updated and LOCK_log
   - Binary log uses now COND_bin_log_updated and LOCK_binlog_end_pos
- Renamed signal_cnt to relay_signal_cnt (as we now have two signals)
- Added some missing error handling in MYSQL_BIN_LOG::new_file_impl()
- Reformatted some comments with old style
- Renamed m_key_LOCK_binlog_end_pos to key_LOCK_binlog_end_pos
- Changed 'signal_update()' to update_binlog_end_pos() which works for
  both relay and binary log
2017-12-18 13:43:37 +02:00
Monty
2e53b96a0a Moved semisync from a plugin to normal server
Part of MDEV-13073 AliSQL Optimize performance of semisync

Did the following renames to match other similar variables
key_ss_mutex_LOCK_binlog_       > key_LOCK_bing
key_ss_cond_COND_binlog_send_  -> key_COND_binlog_send
COND_binlog_send_              -> COND_binlog_send
LOCK_binlog_                   -> LOCK_binlog

debian/mariadb-server-10.2.install does not install semisync libs.
2017-12-18 13:43:36 +02:00
Alexey Botchkov
6ee9cba745 MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables.
Save the rows_examined counter before it gets emptied.
2017-12-18 15:21:50 +04:00
Alexander Barkov
c1e5fef05d MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op()) 2017-12-18 11:25:38 +04:00
Aleksey Midenkov
d5e37621cf Scripts: VTMD_TEMPLATE removed [#286] 2017-12-17 12:32:33 +03:00
Aleksey Midenkov
62b44b0efa Tests: innodb_encryption detect table count 2017-12-17 12:10:19 +03:00
Vesa Pentti
d91d1c8dbc Test cleanup related to MDEV-12501
* Removing unnecessary --plugin-maturity=unknown definitions from tests
2017-12-16 15:34:48 +00:00
Eugene Kosov
9b55cc73f1
SQL, IB: unversioned fields with ALTER TABLE [fixes #401] 2017-12-15 20:37:36 +03:00
Aleksey Midenkov
4624e565f3 System Versioning 1.0 pre6
Merge remote-tracking branch 'mariadb/bb-10.3-temporal-serg' into trunk
2017-12-15 18:12:18 +03:00
Aleksey Midenkov
70d7672377 SQL: MDEV-14633 Assertion on TRT read [fixes #406] 2017-12-15 16:42:25 +03:00
Eugene Kosov
0e0f1126e6
MDEV-14649 Assertion `t->mysql_col_len == 8' failed in row_insert_for_mysql
SQL: add check for internal partition table type

Also fixes MDEV-14654
2017-12-15 16:35:53 +03:00
Aleksey Midenkov
73606a3977 System Versioning 1.0 pre5 [closes #407]
Merge branch '10.3' into trunk

Both field_visibility and VERS_HIDDEN_FLAG exist independently.

TODO:
VERS_HIDDEN_FLAG should be replaced with SYSTEM_INVISIBLE (or COMPLETELY_INVISIBLE?).
2017-12-15 15:18:59 +03:00
Marko Mäkelä
34f2f4fa43 MDEV-14660 Assertion failure in lock_move_rec_list_start() after instant ADD COLUMN
lock_move_rec_list_start(): Relax a too strict assertion.
This function can be invoked on the leftmost leaf page, after all.
So, the first record of each page can be a 'default row' record,
but the 'default row' record must never be locked.
2017-12-15 13:52:27 +02:00
Sergei Golubchik
84e14bff4a privilege: s/delete versioning rows/delete history/ 2017-12-14 20:19:20 +01:00
Sergei Golubchik
18405e5fd9 Partitioning syntax for versioning
partition by system_time (
    partition p0 history,
    partition pn current
 )
2017-12-14 20:19:14 +01:00
Aleksey Midenkov
2ae2876a6c MDEV-14652 NATURAL JOIN crash in mark_common_columns() [fixes #405]
SQL: reverted NATURAL JOIN fix #161 (deprecated by #383)
2017-12-14 21:31:38 +03:00
Aleksey Midenkov
27187443ef MDEV-14650 Assertion 0 failed in TABLE::vers_update_fields [fixes #402]
SQL: fixed selecion of handlerton by respecting partitioning
2017-12-14 19:45:11 +03:00
Aleksey Midenkov
ab5ec0f346 SQL: disable truncate history on partitioned [fixes #399] 2017-12-14 19:11:02 +03:00
Aleksey Midenkov
f96815fe97 SQL: unit resolution Item_field not yet accessible [fixes #398] 2017-12-14 18:42:53 +03:00
Aleksey Midenkov
1668efb722 MDEV-14645: AS OF TIMESTAMP is misused as TRX_ID [fixes #396] 2017-12-14 18:14:21 +03:00
Eugene Kosov
765569602d System Versioning 1.0 pre4
Merge branch '10.3' into trunk
2017-12-14 17:52:08 +03:00
Eugene Kosov
5d5ae2f4fe Tests: fix encryption.debug_key_management [#387] 2017-12-14 15:50:02 +03:00
Eugene Kosov
f14f04838b Tests: fix encryption.encrypt_and_grep [#387] 2017-12-14 15:38:52 +03:00
Aleksey Midenkov
2e3b580ba4 SQL: inner/outer system_time consistency [fixes #384] 2017-12-14 13:43:37 +03:00
Sergei Golubchik
f149013393 rename versioning_* variables 2017-12-14 11:31:44 +01:00
Marko Mäkelä
866ccc8890 Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
Marko Mäkelä
1b5f0cbd46 Merge 10.2 into bb-10.2-ext 2017-12-14 09:53:19 +02:00
Marko Mäkelä
8063804943 Re-remove the file kill_and_restart_mysqld.inc 2017-12-14 08:40:09 +02:00
Marko Mäkelä
ece9c54e10 Merge 10.1 into 10.2 2017-12-14 08:40:01 +02:00
Aleksey Midenkov
eab471260b Paritioning: better error for disabled IB engine 2017-12-13 23:51:30 +03:00
Sergei Golubchik
ca6454bcfe for now, remove FOR SYSTEM_TIME at the end of the query
non-standard, redundant, potentially risky in the future,
hides bugs. See #383, #384, #385

Fixed a parser bug where
SELECT * FROM (t1 join t2) FOR SYSTEM_TIME ...
was not an error.
2017-12-13 21:51:20 +01:00
Sergei Golubchik
a1141e226d fix nullable autoinc test w/o versioning 2017-12-13 21:44:31 +01:00
Sergei Golubchik
e77080c7d5 if a table is partitioned by system_time, its partitions are not versioned
they store history and the history does not have history
2017-12-13 21:44:30 +01:00
Sergei Golubchik
21d0a9fe3b yet another error message fix 2017-12-13 21:32:52 +01:00
Marko Mäkelä
46305b006b Merge 10.0 into 10.1 2017-12-13 19:12:16 +02:00
Marko Mäkelä
b46fa627ca MDEV-12352 InnoDB shutdown should not be blocked by a large transaction rollback
row_undo_step(), trx_rollback_active(): Abort the rollback of a
recovered ordinary transaction if fast shutdown has been initiated.

trx_rollback_resurrected(): Convert an aborted-rollback transaction
into a fake XA PREPARE transaction, so that fast shutdown can proceed.
2017-12-13 18:02:09 +02:00
Aleksey Midenkov
8e8363bb75 SQL: VIEW system fields propagation removed [fixes #393] 2017-12-13 18:23:32 +03:00
Marko Mäkelä
6559ba71a5 MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup while rolling back recovered incomplete transactions
trx_rollback_resurrected(): If shutdown was initiated, fake all
remaining active transactions to XA PREPARE state, so that shutdown
can proceed. Also, make the parameter "all" an output that will be
assigned to FALSE in this case.

trx_rollback_or_clean_recovered(): Remove the shutdown check
(it was moved to trx_rollback_resurrected()).

trx_undo_free_prepared(): Relax assertions.
2017-12-13 16:30:38 +02:00
Aleksey Midenkov
bc4a86699d SQL: recursive CTE inner derived vers_conditions [fix #385] 2017-12-13 15:31:46 +03:00
Marko Mäkelä
b93a87f186 Try to prevent sporadic test failures
On Windows, sometimes more files stay open:

[Warning] InnoDB: innodb_open_files=13 is exceeded (15 files stay open)
2017-12-13 12:52:28 +02:00
Elena Stepanova
0e69d0b094 MDEV-14607 storage_engine-rocksdb.type_bit_indexes fails after latest pushes 2017-12-13 00:29:44 +02:00
Eugene Kosov
717f274b87 MDEV-14631 Assertion `!sys_trx_start && !sys_trx_end' failed in crete_tmp_table
SQL: remove unneeded assertion
SQL: disallow set sys_trx fields in INSERT ... SELECT

Fixes by @midenok.
2017-12-12 22:33:49 +03:00
Eugene Kosov
c66a20b494 SQL: better check for partition engine [#366]
Cleaned up by @midenok.
2017-12-12 22:01:39 +03:00
Eugene Kosov
74cc9ec142 Tests: regenerate funcs_1.is_columns_mysql_embedded [#387] 2017-12-12 21:40:13 +03:00
Aleksey Midenkov
459f40a232
SQL: create..select revisited [closes #370] 2017-12-12 21:30:49 +03:00
Aleksey Midenkov
a0e137c4a9 SQL: RIGHT JOIN in derived [fix #383] 2017-12-12 20:39:44 +03:00
Monty
d4a4185451 MDEV Assertion `partition_id == m_extra_cache_part_id' failed in ha_partition::late_extra_no_cache
The problem was that multi_range_read_info_const() called
multi_range_key_create_key() which changed m_part_spec.start_part,
while there was an activ table scan ongoing.

Fixed by copying and restoring m_part_spec around
multi_range_key_create_calls()
2017-12-12 15:10:53 +02:00
Eugene Kosov
cb4657e3b4
MDEV-14627 SQL: disallow ADD SYSTEM VERSIONING for system-versioned tables
SQL: disallow ADD SYSTEM VERSIONING for system-versioned tables
2017-12-12 14:56:28 +03:00
Marko Mäkelä
ccf22b8025 Post-merge fix: Adjust message codes in results 2017-12-12 13:27:16 +02:00
Marko Mäkelä
34841d2305 Merge bb-10.2-ext into 10.3 2017-12-12 09:57:17 +02:00
Marko Mäkelä
a285e68018 Merge 10.2 into bb-10.2-ext 2017-12-12 09:15:17 +02:00
Eugene Kosov
9c718de2ed Tests: versioning.derived fix for buildbot 2017-12-12 01:04:07 +03:00
Marko Mäkelä
e312a407b8 Merge 10.2 into bb-10.2-ext 2017-12-11 15:06:11 +02:00
Aleksey Midenkov
79dd77e6ae System Versioning 1.0 pre3
Merge branch '10.3' into trunk
2017-12-11 15:43:41 +03:00
Marko Mäkelä
13b9ec651a MDEV-14589 InnoDB should not lock a delete-marked record
When the transaction isolation level is SERIALIZABLE, or when
a locking read is performed in the REPEATABLE READ isolation level,
InnoDB must lock delete-marked records in order to prevent another
transaction from inserting something.

However, at READ UNCOMMITTED or READ COMMITTED isolation level or
when the parameter innodb_locks_unsafe_for_binlog is set, the
repeatability of the reads does not matter, and there is no need
to lock any records.

row_search_mvcc(): Skip locks on delete-marked committed records upfront,
instead of invoking row_unlock_for_mysql() afterwards. The unlocking
never worked for secondary index records.
2017-12-11 14:39:53 +02:00
Marko Mäkelä
86beb08774 Remove an unnecessary dependency on persistent statistics 2017-12-11 09:31:28 +02:00
Aleksey Midenkov
b7cd182896 SQL: DEFAULT value for system fields [closes #376] 2017-12-10 23:52:51 +03:00
Vesa Pentti
99bcec295d MDEV-12501 -- set --maturity-level by default
* Note: breaking change; since this commit, a plugin that has
    worked so far might get rejected due to plugin maturity
  * mariabackup is not affected (allows all plugins)
  * VERSION file defines SERVER_MATURITY, which defines the
    corresponding numeric value as SERVER_MATURITY_LEVEL in
    include/mysql_version.h
  * The default value for 'plugin_maturity' is SERVER_MATURITY_LEVEL - 1
  * Logs a warning if a plugin has maturity lower than
    SERVER_MATURITY_LEVEL
  * Tests suppress the plugin maturity warning
  * Tests use --plugin-maturity=unknown by default so as not to fail
    due to the stricter plugin maturity handling
2017-12-09 23:34:43 +00:00
Jan Lindström
de76cbdcb0 Add Galera test cases that fail to disabled. 2017-12-09 11:21:56 +02:00
Jan Lindström
feb8296ee6 MDEV-14401: Stored procedure that declares a handler that catches ER_LOCK_DEADLOCK error causes thd->is_error() assertion
This was missing bug fix from MySQL wsrep i.e. Galera.
Problem was that if stored procedure declares a handler that
catches deadlock error, then the error may have been
cleared in method sp_rcontext::handle_sql_condition().
Use wsrep_conflict_state correctly to determine is the
error already sent to client.

Add test case for both this bug and MDEV-12837: WSREP: BF
lock wait long. Test requires both fixes to pass.
2017-12-09 11:21:23 +02:00
Jan Lindström
e66bb57267 MDEV-12837: WSREP: BF lock wait long
This is 10.1 version where no merge error exists.

wsrep_on_check
        New check function. Galera can't be enabled
        if innodb-lock-schedule-algorithm=VATS.

innobase_kill_query
        In Galera async kill we could own lock mutex.

innobase_init
        If Variance-Aware-Transaction-Sheduling Algorithm (VATS) is
        used on Galera we refuse to start InnoDB.

Changed innodb-lock-schedule-algorithm as read-only parameter
as it was designed to be.

lock_rec_other_has_expl_req,
lock_rec_other_has_conflicting,
lock_rec_lock_slow
lock_table_other_has_incompatible
lock_rec_insert_check_and_lock

        Change pointer to conflicting lock to normal pointer as this
        pointer contents could be changed later.
2017-12-09 11:20:46 +02:00
Eugene Kosov
2968543f8d IB: NULL instead of autodecrement [closes #373] 2017-12-08 19:37:24 +03:00
Aleksey Midenkov
947aa0bab9 SQL: vers_setup_select() misc refactoring
Renamed to SELECT_LEX::vers_setup_conds().
Moved optimized fields check to JOIN::vers_check_items().
2017-12-08 19:37:24 +03:00
Marko Mäkelä
094b0f869b Merge 10.2 into bb-10.2-ext 2017-12-08 16:00:10 +02:00
Aleksey Midenkov
ad51d77f79 SQL: WHERE top level item [#365 bug 11]
Tests affected (forced mode):

main.range main.range_mrr_icp
2017-12-08 16:26:18 +03:00
Eugene Kosov
8c9c302016 SQL: fix implicit sys fields for implicit engine of partitioned table [#366] 2017-12-08 16:26:18 +03:00
Eugene Kosov
03b54a6b8a SQL: table with duplicate ROW START/END columns [fixes #369] 2017-12-08 16:26:17 +03:00
Aleksey Midenkov
84b718ae70 SQL: derived SYSTEM_TIME clash detection [closes #371] 2017-12-08 16:26:17 +03:00
Sergei Golubchik
b3fe45bcd4 rephrase error messages, fix quoting 2017-12-08 16:26:17 +03:00
Sergei Golubchik
903be4e6be remove my_error_as and one unnecessary error message 2017-12-08 16:26:16 +03:00
Sergei Golubchik
f4270fc544 s/Delete_versioning_rows_priv/Truncate_versioning_priv/
because the statement is TRUNCATE, not DELETE
2017-12-08 16:26:16 +03:00
Sergei Golubchik
ea1ccfa500 SQL: regression fix: make NOW a valid identifier again [#363]
* again, as in 10.2, NOW is a keyword only if followed by parentheses
* use AS OF CURRENT_TIMESTAMP or AS OF NOW()
* AS OF CURRENT_TIMESTAMP and AS OF NOW() mean AS OF NOW(6),
  not AS OF NOW(0), (same behavior as in a DEFAULT clause)
2017-12-08 16:24:56 +03:00
Monty
38908aaf81 Fix failing mtr tests
- Changed rocksdb.2pcgroup_commit.test to print information on error
- Updated myisam_views-big.result
2017-12-08 13:46:23 +02:00
Monty
c2118a08b1 Move all kill mutex protection to LOCK_thd_kill
LOCK_thd_data was used to protect both THD data and
ensure that the THD is not deleted while it was in use

This patch moves the THD delete protection to LOCK_thd_kill,
which already protects the THD for kill.

The benefits are:
- More well defined what LOCK_thd_data protects
- LOCK_thd_data usage is now much simpler and easier to verify
- Less chance of deadlocks in SHOW PROCESS LIST as there is less
  chance of interactions between mutexes
- Remove not needed LOCK_thread_count from
  thd_get_error_context_description()
- Fewer mutex taken for thd->awake()

Other things:
- Don't take mysys->var mutex in show processlist to check if thread
  is kill marked
- thd->awake() now automatically takes the LOCK_thd_kill mutex
  (Simplifies code)
- Apc uses LOCK_thd_kill instead of LOCK_thd_data
2017-12-08 13:46:23 +02:00
Monty
3574f9c7bc Updated MW-388.result file 2017-12-08 13:46:23 +02:00
Jan Lindström
2662228d18 Fix test failures. 2017-12-08 13:34:20 +02:00
Monty
68cd543539 Search for galera libraries also in /usr/lib64/galera-3
This is where Codership's offical rpm's puts them
2017-12-08 11:38:22 +02:00
Monty
c4581735d0 Cleanups
- Remove not used thd_rpl_is_parallel()
- Remove not used mysql_notify_thread_having_shared_lock()
- Remove not needed LOCK_thread_count from MYSQL_BIN_LOG::reset_logs()
  - LOCK_thread_count is not protecting against rollback, so this
    code and comment is not needed
- Remove mutex_locks in slave.cc that are not needed.
  Added THD::assert_not_linked() to ensure that it was safe to remove
- Fixed not repeatable test load_data_stmt_view
- Updated binlog_killed to test removal of mutex
  (thanks to Andrei Elkin for test)
- More code comments
2017-12-08 11:38:22 +02:00
Marko Mäkelä
07e9ff1fe1 MDEV-14378 In ALGORITHM=INPLACE, use a common name for the intermediate tables or partitions
Allow DROP TABLE `#mysql50##sql-...._.` to drop tables that were
being rebuilt by ALGORITHM=INPLACE

NOTE: If the server is killed after the table-rebuilding ALGORITHM=INPLACE
commits inside InnoDB but before the .frm file has been replaced, then
the recovery will involve something else than DROP TABLE.

NOTE: If the server is killed in a true inplace ALTER TABLE commits
inside InnoDB but before the .frm file has been replaced, then we
are really out of luck. To properly handle that situation, we would
need a transactional mysql.ddl_fixup table that directs recovery to
rename or remove files.

prepare_inplace_alter_table_dict(): Use the altered_table->s->table_name
for generating the new_table_name.

table_name_t::part_suffix: The start of the partition name suffix.

table_name_t::dbend(): Return the end of the schema name.

table_name_t::dblen(): Return the length of the schema name, in bytes.

table_name_t::basename(): Return the name without the schema name.

table_name_t::part(): Return the partition name, or NULL if none.

row_drop_table_for_mysql(): Assert for #sql, not #sql-ib.
2017-12-08 10:07:51 +02:00
Marko Mäkelä
0a02c1a667 Merge 10.2 into bb-10.2-ext 2017-12-08 10:02:28 +02:00
Sergei Petrunia
578b26598a MDEV-14607: storage_engine-rocksdb.type_bit_indexes fails after latest pushes
Update the .result file. Old EXPLAIN output was incorrect due to
hitting MDEV-14563.
2017-12-08 01:17:01 +03:00
Marko Mäkelä
3aa618a969 MDEV-13820 trx_id_check() fails during row_log_table_apply()
When logging ROW_T_INSERT or ROW_T_UPDATE records, we did not normalize
the DB_TRX_ID of the current transaction into 0 if the current transaction
had started (modifying other tables) before the ALTER TABLE started.

MDEV-13654 introduced this normalization for ROW_T_DELETE
and for all operations with ADD PRIMARY KEY, in row_log_table_get_pk().
2017-12-07 14:35:32 +02:00
Alexander Barkov
08dae44711 MDEV-14228 MariaDB crashes with function 2017-12-07 15:54:27 +04:00
Jan Lindström
4d016e6ed2 Add Galera test cases that fail to disabled. 2017-12-07 13:08:41 +02:00
Jan Lindström
ba576c5b78 MDEV-14401: Stored procedure that declares a handler that catches ER_LOCK_DEADLOCK error causes thd->is_error() assertion
This was missing bug fix from MySQL wsrep i.e. Galera.
Problem was that if stored procedure declares a handler that
catches deadlock error, then the error may have been
cleared in method sp_rcontext::handle_sql_condition().
Use wsrep_conflict_state correctly to determine is the
error already sent to client.

Add test case for both this bug and MDEV-12837: WSREP: BF
lock wait long. Test requires both fixes to pass.
2017-12-07 13:08:41 +02:00
Marko Mäkelä
976f6fb1b6 Merge bb-10.2-ext into 10.3 2017-12-06 19:36:33 +02:00
Marko Mäkelä
ce07676502 Merge 10.2 into bb-10.2-ext 2017-12-06 19:34:03 +02:00
Marko Mäkelä
77fb7ccba4 Follow-up fix to MDEV-13201 Assertion srv_undo_sources || ... failed on shutdown during DDL operation
Introduce the debug flag trx_t::persistent_stats to suppress the
assertion for the updates of persistent statistics during fast
shutdown.

dict_stats_exec_sql(): Do execute the statement even though shutdown
has been initiated.
2017-12-06 18:52:28 +02:00
Marko Mäkelä
7dc6066dea MDEV-14511 Use fewer transactions for updating InnoDB persistent statistics
dict_stats_exec_sql(): Expect the caller to always provide a transaction.
Remove some redundant assertions. The caller must hold dict_sys->mutex,
but holding dict_operation_lock is only necessary for accessing
data dictionary tables, which we are not accessing.

dict_stats_save_index_stat(): Acquire dict_sys->mutex
for invoking dict_stats_exec_sql().

dict_stats_save(), dict_stats_update_for_index(), dict_stats_update(),
dict_stats_drop_index(), dict_stats_delete_from_table_stats(),
dict_stats_delete_from_index_stats(), dict_stats_drop_table(),
dict_stats_rename_in_table_stats(), dict_stats_rename_in_index_stats(),
dict_stats_rename_table(): Use a single caller-provided
transaction that is started and committed or rolled back by the caller.

dict_stats_process_entry_from_recalc_pool(): Let the caller provide
a transaction object.

ha_innobase::open(): Pass a transaction to dict_stats_init().

ha_innobase::create(), ha_innobase::discard_or_import_tablespace():
Pass a transaction to dict_stats_update().

ha_innobase::rename_table(): Pass a transaction to
dict_stats_rename_table(). We do not use the same transaction
as the one that updated the data dictionary tables, because
we already released the dict_operation_lock. (FIXME: there is
a race condition; a lock wait on SYS_* tables could occur
in another DDL transaction until the data dictionary transaction
is committed.)

ha_innobase::info_low(): Pass a transaction to dict_stats_update()
when calculating persistent statistics.

alter_stats_norebuild(), alter_stats_rebuild(): Update the
persistent statistics as well. In this way, a single transaction
will be used for updating the statistics of a whole table, even
for partitioned tables.

ha_innobase::commit_inplace_alter_table(): Drop statistics for
all partitions when adding or dropping virtual columns, so that
the statistics will be recalculated on the next handler::open().
This is a refactored version of Oracle Bug#22469660 fix.

RecLock::add_to_waitq(), lock_table_enqueue_waiting():
Do not allow a lock wait to occur for updating statistics
in a data dictionary transaction, such as DROP TABLE. Instead,
return the previously unused error code DB_QUE_THR_SUSPENDED.

row_merge_lock_table(), row_mysql_lock_table(): Remove dead code
for handling DB_QUE_THR_SUSPENDED.

row_drop_table_for_mysql(), row_truncate_table_for_mysql():
Drop the statistics as part of the data dictionary transaction.
After TRUNCATE TABLE, the statistics will be recalculated on
subsequent ha_innobase::open(), similar to how the logic after
the above-mentioned Oracle Bug#22469660 fix in
ha_innobase::commit_inplace_alter_table() works.

btr_defragment_thread(): Use a single transaction object for
updating defragmentation statistics.

dict_stats_save_defrag_stats(), dict_stats_save_defrag_stats(),
dict_stats_process_entry_from_defrag_pool(),
dict_defrag_process_entries_from_defrag_pool(),
dict_stats_save_defrag_summary(), dict_stats_save_defrag_stats():
Add a parameter for the transaction.

dict_stats_empty_table(): Make public. This will be called by
row_truncate_table_for_mysql() after dropping persistent statistics,
to clear the memory-based statistics as well.
2017-12-06 18:52:28 +02:00
Marko Mäkelä
afe6aef5ff Adjust the test innodb.virtual_stats and rename to gcol.innodb_virtual_stats 2017-12-06 10:37:08 +02:00
Marko Mäkelä
b1cd5ca2af Import innodb.virtual_stats from MySQL 5.7 2017-12-06 10:35:09 +02:00
Sergei Golubchik
d3845132fc remove 'vers_auto_decrement'
Do not generate fake values when adding an auto-inc column to a versioned
table. This is not a auto-inc issue, but a more general case of adding
a not nullalble unique column to a table with history. We don't support
it yet, not even with a special auto-inc hack. As a workaround, one
can use a nullable unique column, that works.
2017-12-05 18:01:43 +03:00
Sergei Golubchik
e60da371d1 fix versioning tests not to fail w/o innodb 2017-12-05 17:46:01 +03:00
Sergei Golubchik
8dd84ec7f3 versioning/common.inc must "have_innodb"
because it'll fail to start without it
2017-12-05 17:42:27 +03:00
Marko Mäkelä
1d526f31fb Merge 10.1 into 10.2 2017-12-05 14:23:57 +02:00
Sergei Golubchik
3198bc839d Parser: unreserve keywords
SELECT * FROM t1 FOR SYSTEM_TIME AS OF ...

becomes ambiguous, but it's the same as with

SELECT ... UNION SELECT ... ORDER BY ...
2017-12-05 15:09:09 +03:00
Aleksey Midenkov
6ac773421f SQL: WHERE cond freed prematurely for PS [#365 bug 10]
Applicable to vanilla version.
Applies to Item_cond_and, etc.: items with allocating copy_andor_structure().

Tests affected (forced mode):

main.subselect_sj
main.subselect_sj_jcl6
2017-12-05 14:32:34 +03:00
Aleksey Midenkov
3d88a72f76 SQL: fix subquery not a derived table [#365 bug 9]
Tests affected (forced mode):

main.ps \
main.user_var \
main.myisam_explain_non_select_all \
main.opt_tvc \
main.subselect \
main.subselect_no_exists_to_in \
main.derived \
main.derived_opt \
main.update
2017-12-05 14:32:33 +03:00
Vesa Pentti
5868a184fa Revert "MDEV-12501 -- set --maturity-level by default"
This reverts commit 1af2d7ba23.
2017-12-05 08:49:28 +00:00
Vesa Pentti
1af2d7ba23 MDEV-12501 -- set --maturity-level by default
* Note: breaking change; since this commit, a plugin that has
    worked so far might get rejected due to plugin maturity
  * mariabackup is not affected (allows all plugins)
  * VERSION file defines SERVER_MATURITY, which defines the
    corresponding numeric value as SERVER_MATURITY_LEVEL in
    include/mysql_version.h
  * The default value for 'plugin_maturity' is SERVER_MATURITY_LEVEL - 1
  * Logs a warning if a plugin has maturity lower than
    SERVER_MATURITY_LEVEL
  * Tests suppress the plugin maturity warning
  * Tests use --plugin-maturity=unknown by default so as not to fail
    due to the stricter plugin maturity handling
2017-12-04 21:12:35 +00:00
Varun Gupta
60c446584c MDEV-7773: Aggregate stored functions
This commit implements aggregate stored functions. The basic idea behind
the feature is:

* Implement a special instruction FETCH GROUP NEXT ROW that will pause
the execution of the stored function. When the instruction is reached,
execution of the initial query resumes "as if" the function returned.
This gives the server the opportunity to advance to the next row in the
result set.

* Stored aggregates behave like regular aggregate functions. The
implementation of thus resides in the class Item_sum_sp. Because it is
an aggregate function, for each new row in the group, the
Item_sum_sp::add() method will be called. This is when execution resumes
and the function does another iteration to "add" one extra element to
the final result.

* When the end of group is reached, val_xxx() method will be called for
the item. This case is handled by another execute step for the stored
function, only with a special flag to force a call to the return
handler. See Item_sum_sp::execute() for details.

To allow this pause and resume semantic, we must preserve the function
context across executions. This is stored in Item_sp::sp_query_arena only for
aggregate stored functions, but has no impact for regular functions.

We also enforce aggregate functions to include the "FETCH GROUP NEXT ROW"
instruction.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
2017-12-04 13:22:29 +02:00
Aleksey Midenkov
56adced376 SQL,IB: REPLACE semantics [#365 bug 8] 2017-12-04 13:19:37 +03:00
Aleksey Midenkov
5bf14f93a4 Tests: fix combinations 2017-12-04 00:49:44 +03:00
Aleksey Midenkov
68e160fb25 Tests: removed common.inc from results 2017-12-04 00:49:44 +03:00
Monty
d7b0b8ddac MDEV-10688 rpl.rpl_row_log_innodb failed in buildbot
Problem was that Binlog_checkpoint can happen at random times.
Fixed by not write binlog_checkpoint for the rpl_log test.

Other things:
- Removed not used variable "$keep_gtid_events"
- Added option for show_binlog_events to skip binlog_checkpoint
2017-12-03 15:21:53 +02:00
Monty
b016e1ba7f MDEV-7702 Spiral patch 004_mariadb-10.0.15.slave-trx-retry.diff
This is about adding more options to force slave retries

Two new variables has been added:
slave_transaction_retry_errors
- Tells the slave thread to retry transaction for replication when a
  query event returns an error from the provided list. Deadlock and
  elapsed lock wait timeout errors are automatically added to this list
slave-transaction-retry-interval
- Interval of the slave SQL thread will retry a transaction
  in case it failed with a deadlock or elapsed lock wait
  timeout or listed in slave_transaction_retry_errors

Other changes:
- Simplifed code for slave_skip_errors (to be aligned with
  slave_transaction_retry_errors)
- Renamed print_slave_skip_errors() to make_slave_skip_errors_printable()
- Remove printing error from init_slave_skip_errors as my_bitmap_init()
  will do that if needed.
- Generalize has_temporary_error()
2017-12-03 13:58:35 +02:00
Monty
8eeb689e9f Adding multi_range_read support to partitions
Other things:
- Cleanup of allocated bitmaps done in open(), which
  simplifies init_partition_bitmaps()
- Add needed defines in ha_spider.cc to enable new spider code
- Fixed some DBUG_PRINT() to be consistent with normal code
- Removed end space
- The changes in test cases partition_innodb, partition_range,
  partition_pruning etc are becasue partitions can now more exactly
  calculate the number of rows in a range.

Contains spider patches:
014,015,023,033,035,037,040,042,044,045,049,050,051,053,059
2017-12-03 13:58:34 +02:00
Monty
d5268a610a MDEV-7700 Spiral patch 002_mariadb-10.0.15.spider.diff, part 2
Allow partition engines to access table->s->connect_string for engines
that uses HTON_CAN_READ_CONNECT_STRING_IN_PARTITION
Don't reset table->s->connect_string in ha_partition::open
2017-12-03 13:58:34 +02:00
Aleksey Midenkov
70b82f641c SQL: duplicate of historical row fix [#365 bug 7]
Tests affected (forced mode):

main.type_timestamp
2017-12-02 19:52:27 +03:00
Monty
6660708523 Changed "const row not found" to "Const row not found"
Also changed Unique row not found to use uppercase first.
This was done to make these messages consistent with the rest
2017-12-02 12:04:54 +02:00
Eugene Kosov
a3802ecb58 IB: assertion failure on delete with foreign [#366] 2017-12-02 12:54:32 +03:00
Marko Mäkelä
ddac2d7a1e Merge bb-10.2-ext into 10.3 2017-12-01 15:37:30 +02:00
Marko Mäkelä
24c9785a67 Merge 10.2 into bb-10.2-ext 2017-12-01 15:35:16 +02:00
Aleksey Midenkov
5c820a7125 SQL: create_like_table strip versioning for tmp tables [#365 bug 6]
Tests affected (forced versioning):

rpl.rpl_row_merge_engine
2017-12-01 12:21:49 +03:00
Aleksey Midenkov
b9225bb52c SQL: outdated select_lex->where fix [#365 bug 5]
Affected tests (forced mode):

main.index_merge_myisam

After optimization versioning AND takes operands from WHERE AND
leaving `select_lex->where` as empty dangling AND.
2017-11-30 23:23:21 +03:00
Vladislav Vaintroub
f59a1826f8 MDEV-14536 : during backup, retry read of log blocks, if there is
(possibly intermittent) checksum mismatch.
2017-11-30 16:30:40 +00:00
Marko Mäkelä
7cb3520c06 Merge bb-10.2-ext into 10.3 2017-11-30 08:16:37 +02:00
Aleksey Midenkov
e4b86780ae SQL: optimized transformer fix [#365 bug 4]
Affected tests (forced mode):

main.win
main.selectivity_innodb
main.subselect_cache
main.analyze_stmt_orderby

Related to #226 (909867d014).
2017-11-30 08:31:38 +03:00
Aleksey Midenkov
2305666a05 SQL: insert delayed fix [#365 bug 3]
Affected tests (forced mode): rpl.rpl_timezone
2017-11-29 11:58:18 +03:00
Alexander Barkov
5b697c5a23 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-11-29 12:06:48 +04:00
Aleksey Midenkov
47ea526efa IB: get template with virtual columns [#365 bug 1]
Affected tests (forced mode): binlog_encryption.encrypted_slave
2017-11-29 10:48:10 +03:00
Alexander Barkov
e01d33d773 MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
1. Removing data type specific constants from enum_item_param_state,
   adding SHORT_DATA_VALUE instead.
2. Replacing tests for Item_param::state for the removed constants to
   tests for Type_handler::cmp_type() against {INT|REAL|TIME|DECIAML}_RESULT.
   Deriving Item_param::PValue from Type_handler_hybrid_field_type,
   to store the data type handler of the current value of the parameter.

3. Moving Item_param::decimal_value and Item_param::str_value_ptr
   to Item_param::PValue. Adding Item_param::PValue::m_string
   and changing Item_param to use it to store string values,
   instead of Item::str_value. The intent is to replace Item_param::value
   to a st_value based implementation in the future, to avoid duplicate code.
   Adding a sub-class Item::PValue_simple, to implement
   Item_param::PValue::swap() easier.
   Remaming Item_basic_value::fix_charset_and_length_from_str_value()
   to fix_charset_and_length() and adding the "CHARSET_INFO" pointer
   parameter, instead of getting it directly from item->str_value.charset().
   Changing Item_param to pass value.m_string.charset() instead
   of str_value.charset().
   Adding a String argument to the overloaded
   fix_charset_and_length_from_str_value() and changing Item_param
   to pass value.m_string instead of str_value.

4. Replacing the case in Item_param::save_in_field() to a call
   for Type_handler::Item_save_in_field().

5. Adding new methods into Item_param::PValue:
   val_real(), val_int(), val_decimal(), val_str().
   Changing the corresponding Item_param methods
   to use these new Item_param::PValue methods
   internally. Adding a helper method
   Item_param::can_return_value() and removing
   duplicate code in Item_param::val_xxx().

6. Removing value.set_handler() from Item_param::set_conversion()
   and Type_handler_xxx::Item_param_set_from_value().
   It's now done inside Item_param::set_param_func(),
   Item_param::set_value() and Item_param::set_limit_clause_param().

7. Changing Type_handler_int_result::Item_param_set_from_value()
   to set max_length using attr->max_length instead of
   MY_INT64_NUM_DECIMAL_DIGITS, to preserve the data type
   of the assigned expression more precisely.

8. Adding Type_handler_hybrid_field_type::swap(),
   using it in Item_param::PValue::swap().

9. Moving the data-type specific code from
   Item_param::query_val_str(), Item_param::eq(),
   Item_param::clone_item() to
   Item_param::value_query_type_str(),
   Item_param::value_eq(), Item_param::value_clone_item(),
   to split the "state" dependent code and
   the data type dependent code.
   Later we'll split the data type related code further
   and add new methods in Type_handler. This will be done
   after we replace Item_param::PValue to st_value.

10. Adding asserts into set_int(), set_double(), set_decimal(),
   set_time(), set_str(), set_longdata() to make sure that
   the value set to Item_param corresponds to the previously
   set data type handler.

11. Adding tests into t/ps.test and suite/binlog/t/binlog_stm_ps.test,
   to cover Item_param::print() and Item_param::append_for_log()
   for LIMIT clause parameters.
   Note, the patch does not change the behavior covered by the new
   tests. Adding for better code coverage.

12. Adding tests for more precise integer data type in queries like this:
    EXECUTE IMMEDIATE
     'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b'
      USING 999999999;
    The explicit integer literal and the same integer literal
    passed as a PS parameter now produce columns of the same data type.
    Re-recording old results in ps.result, gis.result, func_hybrid_type.result
    accordingly.
2017-11-29 10:03:51 +04:00
Aleksey Midenkov
f924a94d2f SQL: disable versioned DML for transaction_registry=off [closes #364] 2017-11-28 18:38:54 +03:00
Aleksey Midenkov
f826f1249b Tests: suppress tinyint error for ppc64le [#347] 2017-11-28 14:21:00 +03:00
Eugene Kosov
8eac050440
Tests: revert unneded changes 2017-11-28 11:40:13 +03:00
Aleksey Midenkov
f9d875d212 SQL: disable engine change [fixes #358] 2017-11-27 19:48:36 +03:00
Aleksey Midenkov
941e8b7b0b Tests: suppression for innodb.log_corruption 2017-11-27 16:38:43 +03:00
Aleksey Midenkov
1e3620cc39 Tests: commit_id, truncate for Windows fix [#307] 2017-11-27 16:31:18 +03:00