Commit graph

184064 commits

Author SHA1 Message Date
Sergei Golubchik
f0f0d07250 MDEV-14500 filesort to support engines with slow rnd_pos
If the engine wants to avoid rnd_pos() - force a temporary table
before a filesort. But don't do it if addon_fields are used.
2018-11-20 15:06:03 +01:00
Sergei Golubchik
cd29aee50d misc cleanup 2018-11-20 15:05:58 +01:00
Sergei Golubchik
1823ce7304 cleanup: rename a flag, keep old name for compatibility 2018-11-20 15:05:52 +01:00
Sergei Golubchik
649465db41 cleanup: remove HA_WANTS_PRIMARY_KEY as redundant
We don't have many bits left, no need to add another InnoDB-specific flag.
Instead, we say that HA_REQUIRE_PRIMARY_KEY does not apply to SEQUENCE.
Meaning, if the engine declares HA_CAN_TABLES_WITHOUT_ROLLBACK (required
for SEQUENCE) it *must* support tables without a primary key.
2018-11-20 15:05:46 +01:00
Marko Mäkelä
5aaee3746e MDEV-17721: Corrupted data dictionary after instant DROP COLUMN
dict_index_t::clear_instant_alter(): Correctly sort the index fields
to correspond to the columns of the table.
2018-11-20 13:32:20 +02:00
Alexander Barkov
21a5884081 MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N)) 2018-11-20 13:47:52 +04:00
Marko Mäkelä
dde2ca4aa1 Merge 10.3 into 10.4 2018-11-19 20:22:33 +02:00
Marko Mäkelä
fd58bb71e2 Merge 10.2 into 10.3 2018-11-19 18:45:53 +02:00
Marko Mäkelä
e669e705a1 Fix the Windows build
Commit ff88e4bb8a broke the Windows build.
Clean up one more redundant #include to fix it.
2018-11-19 13:13:39 +02:00
Marko Mäkelä
ff88e4bb8a Remove many redundant #include from InnoDB 2018-11-19 11:42:14 +02:00
Marko Mäkelä
cb5bca721b MDEV-17765 lock_discard_page() may fail to discard locks for SPATIAL INDEX
lock_discard_page(): Traverse and discard the B-tree record locks
only if they exist. Else, discard the R-tree (spatial) index locks.
2018-11-19 11:40:10 +02:00
Marko Mäkelä
f037b91098 MDEV-17726: Fix compiler warning
Compare against the correct constant 0. NOT_KILLED belongs to
enum killed_state, while THD_IS_NOT_KILLED is what we want.
2018-11-19 11:11:53 +02:00
Alexander Barkov
b5ac863f14 Grammar cleanup: adding missing and removing redundant semicolons
modified:   sql_yacc.yy
  modified:   sql_yacc_ora.yy
2018-11-19 12:41:01 +04:00
Marko Mäkelä
7debbd7859 Fix a compilation error
ib_counter_t::ib_counter_element_t: Avoid sizeof on a std::atomic type,
because it causes errors on some version of the Microsoft compiler.
2018-11-18 15:50:43 +02:00
Marko Mäkelä
075820ab23 MDEV-17750: Fix the Windows build
Remove some redundant declarations of global variables. These declarations
can refer to undefined type names, because they occur before any #include
statement for the type definitions. On GNU/Linux, uint and ulong seem to
be defined in <sys/types.h> due to _DEFAULT_SOURCE and __USE_MISC
becoming defined in <features.h>.
2018-11-18 15:46:53 +02:00
Alexander Barkov
d2ba9edd66 MDEV-17740 Extend EXTRACT(x AS DAY*) to understand long time intervals 2018-11-17 10:14:44 +04:00
Marko Mäkelä
f92d223fe2 MDEV-17750: Remove dict_index_get_sys_col_pos()
dict_index_t::db_trx_id(): Return the position of DB_TRX_ID.
Only valid for the clustered index.

dict_index_t::db_roll_ptr(): Return the position of DB_ROLL_PTR.
Only valid for the clustered index.

dict_index_get_sys_col_pos(): Remove. This was performing unnecessarily
complex computations, which only made sense for DB_ROW_ID, which would
exist either as the first field in the clustered index or as the last
field in a secondary index (only when a DB_ROW_ID column is materialised).

row_sel_store_row_id_to_prebuilt(): Remove, and replace with simpler code.

row_upd_index_entry_sys_field(): Remove.

btr_cur_log_sys(): Replaces row_upd_write_sys_vals_to_log().

btr_cur_write_sys(): Write DB_TRX_ID,DB_ROLL_PTR to a data tuple.
2018-11-16 20:37:06 +02:00
Marko Mäkelä
eea0c3c3e7 MDEV-17750: Remove unnecessary rec_get_offsets() in IMPORT TABLESPACE
row_import_set_sys_max_row_id(): Change the return type to void,
and access the first column (DB_ROW_ID) directly.
2018-11-16 20:37:00 +02:00
Marko Mäkelä
3773bc594d MDEV-17750: Avoid some rec_get_offsets() for accessing FTS_DOC_ID
fts_get_max_doc_id(): Remove totally unnecessary call to rec_get_offsets().
In FTS_DOC_ID_INDEX, the FTS_DOC_ID is always stored in the first 8 bytes
of the record.

fts_get_doc_id_from_row(): Get the offsets from the caller.

row_ins_foreign_check_on_constraint(): Invoke rec_get_offsets()
for the call.
2018-11-16 20:36:47 +02:00
Marko Mäkelä
0cbf578ac8 Add dict_index_t member functions for determining index type 2018-11-16 20:36:47 +02:00
Monty
37d6d3b661 Max transid was not stored directly after Aria recovery
This caused ma_test_recovery.pl to fail

Other things:
- Fixed bug where "ma_test_recovert.pl --abort-on-error" didn't abort
  on error
2018-11-16 16:54:33 +02:00
Marko Mäkelä
16d43150ae MDEV-17721 Corrupted data dictionary after instant ADD COLUMN
dict_index_t::reconstruct_fields(): Correctly permute the fields
of the columns. The code was totally wrong in MDEV-15562.
It would only work when columns are added last or dropped,
but not when columns are permuted.
2018-11-16 16:35:56 +02:00
Marko Mäkelä
f85012246c MDEV-17735 Assertion failure in row_parse_int() on first ADD/DROP COLUMN
row_ins_clust_index_entry_low(): Do not attempt to read an AUTO_INCREMENT
column value from a metadata record, because it does not make any sense.
Moreover, the field offset would be off by one in case the AUTO_INCREMENT
column is not part of the PRIMARY KEY, because the MDEV-15562 metadata
record would contain an extra field at index->first_user_field().

On MariaDB Server 10.3 after MDEV-11369, we would unnecessarily read
a dummy AUTO_INCREMENT value from the metadata record, but that value
would always be written as NULL or 0, so there is no problem.
2018-11-16 13:28:37 +02:00
Eugene Kosov
89337d510e MDEV-16580 Remove unused monitor counters from InnoDB
Remove one totally dead monitor.
2018-11-16 11:52:44 +03:00
Marko Mäkelä
ab812c1089 MDEV-17726: A better fix
THD::close_temporary_tables(): Revert the change.

ha_innobase::delete_table(): Move the work-around inside
a debug assertion, and check thd_kill_level() instead of thd_killed(),
because the latter would not hold for KILL_CONNECTION.
2018-11-16 10:42:45 +02:00
Alexander Barkov
c75a277afe A cleanup for "MDEV-17477 Wrong result for TIME('-2001-01-01 10:20:30')"
modified:   ../sql-common/my_time.c

Moving the logic that mixes warnings of two kinds:
- those came from truncating garbage before the actual parsing of date/time
- those came during the actual parsing
from outside to inside of str_to_datetime_or_date_body().
This makes the caller code easier and removes some code duplication.
We'll be adding more parsing functions for time intervals soon,
so this change helps to avoid more duplicate code in the coming functions.
2018-11-16 10:09:12 +04:00
Varun Gupta
705abdebaf MDEV-13170: Database service (MySQL) stops after update with trigger
For prepare statemtent/stored procedures we rollback the items to original
ones after prepare execution in the function reinit_stmt_before_use.
This rollback is done for group by, order by clauses but is not done for
the window specification containing the order by and partition by clause of the
window function.
2018-11-16 10:43:53 +05:30
Oleksandr Byelkin
f74649b522 Merge branch '10.1' into 10.2 2018-11-15 19:21:40 +01:00
Vladislav Vaintroub
a93ac8d95f MDEV-16448 mysql_upgrade_service remove my.ini variables that are no more valid
MDEV-16447 incorporate Innodb slow shutdown into mysql_upgrade_service.exe
2018-11-15 18:03:30 +01:00
Vladislav Vaintroub
efc235d84d Fix test result.
in 10.3, AWS encryption key was loaded during recovery, by the innodb purge
thread, therefore no note "loaded key" was written by the foreground
thread.
2018-11-15 18:03:30 +01:00
Oleksandr Byelkin
a77f80b79e Merge branch '10.0' into 10.1 2018-11-15 17:20:26 +01:00
Marko Mäkelä
c6838cc646 MDEV-17726 Assertion `sqlcom != SQLCOM_TRUNCATE' failed in ha_innobase::delete_table after truncating temporary table
THD::close_temporary_tables(): Assign lex->sql_command so that
the debug assertion will not fail in ha_innobase::delete_table().

Alternatively, we could ensure that thd_killed() holds inside
ha_innobase::delete_table().

There should be no impact for the non-debug build. The thd_sql_command()
inside ha_innobase::delete_table() only affects the treatment of
persistent FOREIGN KEY metadata. There is no persistent metadata
nor foreign key constraints for temporary tables.

No test case was added, because the failure is nondeterministic.
2018-11-15 17:52:57 +02:00
Oleksandr Byelkin
a84d87fde8 Merge branch '5.5' into 10.0 2018-11-15 13:57:35 +01:00
Alexander Barkov
1956695c69 MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615
The fix for "MDEV-17698 MEMORY engine performance regression"
previously fixed this problem.

- Adding the test for MDEV-17724
- Re-recording wrong results for tests:
  * engines/iuds/r/insert_number
  * engines/iuds/r/update_delete_number
  which started to fail since MDEV-17698
2018-11-15 16:45:43 +04:00
Alexander Barkov
7f175595c8 Backport for "MDEV-17698 MEMORY engine performance regression"
Also, backporting a part of:
  MDEV-11485 Split Item_func_between::val_int() into virtual methods in Type_handler
for easier merge to 10.3.
2018-11-15 06:35:37 +04:00
Oleksandr Byelkin
7e75643778 Merge branch '10.1' into 10.2 2018-11-14 18:40:09 +01:00
Oleksandr Byelkin
9e23171c70 Merge branch '10.0' into 10.1 2018-11-14 16:58:33 +01:00
Oleksandr Byelkin
47274d902e fix of test suite 2018-11-14 15:46:53 +01:00
Alexander Barkov
b9a9055793 MDEV-17712 Remove C_TIME_FUZZY_DATES, C_TIME_DATETIME_ONLY, C_TIME_TIME_ONLY 2018-11-14 16:00:38 +04:00
Alexander Barkov
13cd4cf436 MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH)
sp_instr_cursor_copy_struct::exec_core() created TYPELIBs on a wrong mem_root,
the one which is initialized in sp_head::execute(), this code:

  /* init per-instruction memroot */
  init_sql_alloc(&execute_mem_root, "per_instruction_memroot",
                 MEM_ROOT_BLOCK_SIZE, 0, MYF(0));

This memory root cleans up after every sp_instr_xxx executed, so later
sp_instr_cfetch::execute() tried to use already freed and trashed memory.

Changing sp_instr_cursor_copy_struct::exec_core() to call tmp.export_structure()
inside this block (not outside of it):
  thd->set_n_backup_active_arena(thd->spcont->callers_arena, &current_arena);
  ...
  thd->restore_active_arena(thd->spcont->callers_arena, &current_arena);

So now TYPELIBs created by sp_instr_cursor_copy_struct::exec_core() are
still available and valid when sp_instr_cfetch::execute() is called.
They are freed at the end of dispatch_command() corresponding to
the "CALL p1" statement.
2018-11-14 14:23:43 +04:00
Alexander Barkov
45769429d9 MDEV-17698 MEMORY engine performance regression 2018-11-14 13:56:18 +04:00
Oleksandr Byelkin
01d3e40197 MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date
- clean up DEFAULT() to work only with default value and correctly print
  itself.
- fix of DBUG_ASSERT about fields read/write
- fix of field marking for write based really on the thd->mark_used_columns flag
2018-11-14 10:27:41 +01:00
Marko Mäkelä
f718477714 os_aio_validate_skip(): Fix a data race 2018-11-14 09:41:37 +02:00
Alexander Barkov
62bcd74712 MDEV-17694 Add method LEX::sp_proc_stmt_statement_finalize() 2018-11-14 07:38:28 +04:00
Daniel Bartholomew
c688ab29ca bump the VERSION 2018-11-13 11:14:21 -05:00
Alexander Barkov
2a0b6de41b MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly 2018-11-13 18:03:14 +04:00
Andrei Elkin
573c4db57a MDEV-17437 followup: fixing compilation on non-HAVE_POLL. 2018-11-13 14:54:33 +02:00
Sergei Golubchik
34a3972497 MDEV-14429 sql_safe_updates in my.cnf not work
update test results for embedded

followup for 564a63b5a3 and 89a87e8e42
2018-11-13 10:30:27 +01:00
Sergei Golubchik
8d61a7fb9f compiler warning: this statement may fall through 2018-11-13 10:30:27 +01:00
Aleksey Midenkov
50bc55d462 MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end()
Discrepancy in open indexes due to overwritten `read_partitions` upon
`ha_open()` in `ha_partition::clone()`.

[Fixes ]
2018-11-13 10:30:27 +01:00