Commit graph

71 commits

Author SHA1 Message Date
Marko Mäkelä
ec40980ddd Merge 10.3 into 10.4 2019-11-01 15:23:18 +02:00
Oleksandr Byelkin
de2186dd2f MDEV-20074: Lost connection on update trigger
Instead of checking lex->sql_command which does not corect in case of triggers
mark tables for insert.
2019-10-17 17:32:14 +02:00
Michael Widenius
b5615eff0d Write information about restart in .result
Idea comes from MySQL which does something similar
2019-04-01 19:47:24 +03:00
Monty
d30124e844 MDEV-17503 CREATE SEQUENCE failed with innodb_force_primary_key =1
Fixed by adding table flag HA_WANTS_PRIMARY_KEY, which is like
HA_REQUIRE_PRIMARY_KEY but tells SQL upper layer that the storage engine
internally can handle tables without primary keys (for example for
sequences or trough user variables)
2018-10-29 16:12:52 +02:00
Monty
7aa80ba66b Sequences with negative numbers and auto_increment_increment crashes
This also fixes MDEV-16313 Assertion `next_free_value % real_increment == offset' fails upon CREATE SEQUENCE in galera cluster

Fixed by adding llabs() to assert.
Also adjusted auto_increment_offset to mod auto_increment_increment.
2018-08-30 17:38:01 +03:00
Monty
d6976a7e52 MDEV-16234 CREATE TABLE .. SELECT LASTVAL breaks replication
Fixed by marking NEXTVAL() and LASTVAL() to be replicated row based
2018-05-22 18:33:18 +03:00
Michael Widenius
1cb4caa66d MDEV-15970 Crash when doing truncate on locked sequence
Problem was that we used table->s->db_type() for accessing
handlerton of opened file instead of table->file->ht

Other bug fixed:
- Ensure that we set error if reopen_tables() fails
  (This was the cause of assert)
2018-05-14 10:08:05 +03:00
Elena Stepanova
2deb17fd54 sql_sequence.debug_sync fails upon server startup
Debug command-line option should be loose, otherwise the test
fails before it has a chance to be skipped
2018-05-09 02:05:25 +03:00
Monty
a536664e80 Added test case for MDEV-13029
MDEV 13029 Assertion `ds_control' failed in debug_sync upon closing connection
after creating temporary sequence

This test doesn't fail anymore. Adding it to ensure that the bug doesn't
appear again.
2018-05-08 13:29:41 +03:00
Monty
bd09c5ca86 Added test case for MDEV-13007 ALTER .. ENGINE on temporary sequence may go wrong
Looks like the bug was fixed some time ago (at least I can't repeat it).
I added the test case just have this case tested properly.
2018-05-07 16:39:53 +03:00
Oleksandr Byelkin
a22a339f8e MDEV-13024: Server crashes in my_store_ptr upon DELETE from sequence in multi-table format
It is test only (fix was done by Monty in ha_sequence::open by allocating ref)
2018-05-06 22:21:55 +02:00
Monty
0bfd45f634 Fix for MDEV-15812 Assert in SEQUENCE when forcing STATEMEMT format
The bug was the we copied the lock type to the underlying engine even when
external_lock failed.
2018-05-06 19:39:48 +03:00
Monty
57c3dd991b MDEV-15106 Unexpected ER_WRONG_INSERT_INTO_SEQUENCE upon INSERT with multiple locks on sequences
Fixed by removing the check of single lock in sequence insert and let MDL
code handle deadlock detection
2018-05-03 17:49:39 +03:00
Oleksandr Byelkin
0bdc15d86e MDEV-15732: Assertion `next_free_value % real_increment == offset && next_free_value >= reserved_until' failed in sequence_definition::adjust_values upon SETVAL for sequence with INCREMENT 0
there was a problem with "next_free_value >= reserved_until" condition:
SEQUENCE::set_value handle next_free_value & reserved_until after adjust_values() call, so it is incorect to put assert on it in adjust_values()
2018-04-26 15:38:16 +02:00
Marko Mäkelä
1730ac5c4a MDEV-15348 Failure to load CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
dict_sys_tables_type_valid(): Do not reject NO_ROLLBACK (sequence)
in ROW_FORMAT=REDUNDANT.

dict_load_table_low(): When flagging an error, assign *table = NULL.
Failure to do so could cause a crash if an error was flagged when
accessing INFORMATION_SCHEMA.INNODB_SYS_TABLES.
2018-04-07 04:22:44 +03:00
Michael Widenius
e27bfeca6a Added test case for MDEV-15742 to prove that it works
MDEV-15742 Assertion `table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == 1' failed in handler::ha_write_row
2018-04-06 12:31:13 +03:00
Michael Widenius
d8da97b09a MDEV-14762 Server crashes in MDL_ticket::has_stronger_or_equal_type upon inserting into temporary sequence
Fix is to not upgrade MDL locks for temporary tables
2018-04-05 15:17:41 +03:00
Monty
7d2e283562 Fix for MDEV-14831
MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the
sequence, causes ER_KEY_NOT_FOUND

The problem was that sequence_insert didn't properly handle the case
where there where there was a LOCK TABLE while creating the sequence.

Fixed by opening the sequence table, for inserting the first record, in
a new environment without any other open tables.

Found also a bug in Locked_tables_list::reopen_tables() where the lock
structure for the new tables was allocated in THD::mem_root, which causes
crashes. This could cause problems with other create tables done under
LOCK TABLES.
2018-04-02 12:42:48 +03:00
Monty
4277c173a9 MDEV-15149 Assert upon concurrent creating / querying sequences
MDEV-15117 Server crashes in in open_and_process_table or ASAN
heap-use-after-free in is_temporary_table upon creating/flushing
sequences.

Problem was that sequence_insert closed and reopened the like table
without proper locking.  Fixed by ensuring that the like table is
not reopened in sequence_insert
2018-03-29 14:20:11 +03:00
Monty
cd93eeeb1d MDEV-15149 Assert upon concurrent creating / querying sequences
Problem was that sequence_insert closed and reopened the like table
without proper locking.  Fixed by ensuring that the like table is
not reopened in sequence_insert
2018-03-29 14:20:11 +03:00
Marko Mäkelä
2ba487cfe8 Merge bb-10.2-ext into 10.3 2018-02-19 11:37:29 +02:00
Monty
ef3147b1d6 Fix for MDEV-15105 (memory loss with LOCK sequence)
MDEV 15105 "Bytes lost and Assertion `global_status_var.global_memory_used == 0' fails on shutdown after attempts
to LOCK/RENAME sequence"
2018-02-19 11:27:21 +02:00
Monty
06ba07c269 Test case for MDEV-12887 (bug fixed long ago)
MDEV-12887 UT_LIST_GET_LEN(trx->lock.trx_locks) == 0 when mysqldump
sequence
2018-02-19 11:26:25 +02:00
Monty
144616034c Don't run sql_sequence.grant for embeddes server 2018-02-16 01:35:19 +02:00
Marko Mäkelä
cc3b5d1fe7 Merge bb-10.2-ext into 10.3 2018-02-15 11:48:30 +02:00
Monty
7bd81c726b Crash when giving error message for ALTER SEQUENCE
Fixes MDEV-14761 "Assertion `!mysql_parse_status || thd->is_error() ||
thd->get_internal_handler()' failed in parse_sql"
2018-02-15 10:18:55 +02:00
Monty
1fe9092d06 Fix privilege checking for sequence
MDEV-13732 User with SELECT privilege can ALTER sequence
2018-02-14 16:43:22 +02:00
Marko Mäkelä
883496782f Merge bb-10.2-ext into 10.3 2018-02-06 17:12:17 +02:00
Marko Mäkelä
560b9895d4 MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
dict_tf_is_valid(): Allow no-rollback tables in ROW_FORMAT=REDUNDANT.
2018-02-06 17:09:26 +02:00
Marko Mäkelä
6dd302d164 Merge bb-10.2-ext into 10.3 2018-01-11 19:44:41 +02:00
Marko Mäkelä
773c3ceb57 MDEV-14824 Assertion `!trx_is_started(trx)' failed in innobase_start_trx_and_assign_read_view
In CREATE SEQUENCE or CREATE TEMPORARY SEQUENCE, we should not start
an InnoDB transaction for inserting the sequence status record into
the underlying no-rollback table. Because we did this, a debug assertion
failure would fail in START TRANSACTION WITH CONSISTENT SNAPSHOT after
CREATE TEMPORARY SEQUENCE was executed.

row_ins_step(): Do not start the transaction. Let the caller do that.

que_thr_step(): Start the transaction before calling row_ins_step().

row_ins_clust_index_entry(): Skip locking and undo logging for no-rollback
tables, even for temporary no-rollback tables.

row_ins_index_entry(): Allow trx->id==0 for no-rollback tables.

row_insert_for_mysql(): Do not start a transaction for no-rollback tables.
2018-01-11 16:34:31 +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
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
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
Marko Mäkelä
7cb3520c06 Merge bb-10.2-ext into 10.3 2017-11-30 08:16:37 +02:00
Alexander Barkov
4a8039b04e Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-11-20 11:12:08 +04:00
Aleksey Midenkov
31bd86c8df Tests: dependency on wsrep removed from sql_sequence tests
Affected tests:
sql_sequence.gtid sql_sequence.replication
2017-11-16 16:29:14 +08:00
Alexander Barkov
5d3ed9acdd (Part#2) MDEV-13049 Querying INFORMATION_SCHEMA becomes slow in MariaDB 10.1
This is a 10.3 specific part of MDEV-13049.
It disables automatic sorting for
"SELECT .. FROM INFORMATION_SCHEMA.{SCHEMATA|TABLES}"
and adjusts the affected tests accordingly.
2017-10-31 13:00:20 +04:00
Alexander Barkov
835cbbcc7b Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
TODO: enable MDEV-13049 optimization for 10.3
2017-10-30 20:47:39 +04:00
Aleksey Midenkov
1355fadb59 MDEV-13720 Server crashes in SEQUENCE::write_lock for temporary tables
This happens when doing NEXT VALUE for a temporary table
Fixed by giving ER_NOT_SEQUENCE when trying to use normal temporary table with
sequence functions

Signed-off-by: Monty <monty@mariadb.org>
2017-10-22 20:30:57 +03:00
Aleksey Midenkov
eea07f5f58 MDEV-13721 Assertion is_lock_owner() failed in mysql_rm_table_no_locks
This happened when trying to do delete a sequence hidden by a temporary
table.
Fixed by ignoring non-sequence temporary tables when trying to drop
sequences.

Signed-off-by: Monty <monty@mariadb.org>
2017-10-22 20:23:09 +03:00
Aleksey Midenkov
7204f66c6a MDEV-13711 Assertion failure on CREATE TABLE .. LIKE <sequence>
Fixes two issues:
- Update assert in open_and_process_tables to handle sequences
- Removed not needed and conflicting mdl_context.release_transactional_locks
  in sql_sequence.cc. The MDL lock is released at end of
  mysql_execute_command().

Signed-off-by: Monty <monty@mariadb.org>
2017-10-22 20:23:09 +03:00
Aleksey Midenkov
7447b4ce37 MDEV-13714 Value of SEQUENCE table option is ignored upon creation
CREATE TABLE ... sequence=0 and sequence=DEFAULT created sequence tables
when they should not.

Signed-off-by: Monty <monty@mariadb.org>
2017-10-22 20:23:09 +03:00
Aleksey Midenkov
f64cff9206 MDEV-13715 Server crashes in ha_partition::engine_name
This happened when trying to PARTITION a SEQUENCE table
Problem was that wrong function was used to get engine name

Signed-off-by: Monty <monty@mariadb.org>
2017-10-22 20:20:32 +03:00
Michael Widenius
211f9eea60 MDEV-14092 NEXTVAL fails on slave
The problem was that the code in replication didn't distinguish between a
setval() failing because the stored sequence number was bigger than the
current (should have been ignored) and a failure from the storage engine.
2017-10-19 13:25:02 +03:00
Sergei Golubchik
2d2f857fb3 fixes for --embedded 2017-10-06 12:28:56 +02:00
Marko Mäkelä
e3d44f5d62 Merge bb-10.2-ext into 10.3 2017-09-21 08:12:19 +03:00
Marko Mäkelä
72a8024217 After-merge fix: Adjust some results. 2017-09-21 07:58:08 +03:00
Monty
ef2ecf0370 MDEV-13732 User with SELECT privilege can ALTER sequence
Bug in privilege checking of sequences. Test case added.
2017-09-08 13:24:42 +03:00