summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-20715 : Implement system variable to disallow local GTIDs in Galerabb-10.6-MDEV-20715Jan Lindström2021-03-011-1/+35
| | | | | | | | | | | | Added a new wsrep_mode feature DISALLOW_LOCAL_GTID for this. Nodes can have GTIDs for local transactions in the following scenarios: A DDL statement is executed with wsrep_OSU_method=RSU set. A DML statement writes to a non-InnoDB table. A DML statement writes to an InnoDB table with wsrep_on=OFF set. If user has set wsrep_mode=DISALLOW_LOCAL_GTID these operations produce a error ERROR HY000: Galera replication not supported
* MDEV-24830 : Write a warning to error log if Galera replicates InnoDB table ↵bb-10.6-MDEV-24830Jan Lindström2021-02-221-31/+6
| | | | | | | | | | | | | | with no primary key Two new features for Galera * Write a warning to error log if Galera replicates table with storage engine not supported by Galera (at the moment only InnoDB is supported ** Warning is pushed to client also ** MyISAM is allowed if wsrep_replicate_myisam=ON * Write a warning to error log if Galera replicates table with no primary key ** Warning is pushed to client also ** MyISAM is allowed if wsrep_relicate_myisam=ON * In both cases apply flood control if > 10 same warning is writen to error log (requires log_warnings > 1), flood control will suppress warnings for 300 seconds
* MDEV-20008: Galera strict modebb-10.6-MDEV-20008mkaruza2021-01-261-0/+13
| | | | | | | | | | | | | Added new enum variable `wsrep_mode` which can be used to turn on WSREP features which are not part of default behaviour. Added enum `BINLOG_ROW_FORMAT_ONLY`, `REQUIRED_PRIMARY_KEY` and `STRICT_REPLICATION`. `wsrep-mode=STRICT_REPLICATION` behaves like variable `wsrep_strict_ddl`. Variable wsrep_strict_ddl is deprecated and if set we use new wsrep_mode setting instead. Reviewed and improved by: Jan Lindström <jan.lindstrom@mariadb.com>
* Merge 10.4 into 10.5Marko Mäkelä2021-01-111-45/+77
|\
| * Merge 10.3 into 10.4Marko Mäkelä2021-01-111-45/+77
| |\
| | * Merge 10.2 into 10.3 (except MDEV-17556)Marko Mäkelä2021-01-111-45/+77
| | |\ | | | | | | | | | | | | | | | | | | | | The fix of MDEV-17556 (commit e25623e78a3efde05e30070dc7362f8dc0d8c459 and commit 61a362c9493df63dc588fcb71409537ae56ab9c8) has been omitted due to conflicts and will have to be applied separately later.
| | | * MDEV-23033: All slaves crash once in ~24 hours and loop restart with signal 11Sujatha2021-01-041-44/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======= Upon deleting or updating a row in a parent table (with primary key), if the child table has virtual column and an associated key with ON UPDATE CASCADE/ON DELETE CASCADE, it will result in slave crash. Analysis: ======== Tables which are related through foreign key require prelocking similar to triggers. i.e If a table has triggers/foreign keys we should add all tables and routines used by them to the prelocking set. This prelocking happens during 'open_and_lock_tables' call. Each table being opened is checked for foreign key references. If foreign key reference exists then the child table is opened and it is linked to the table_list. Upon any modification to parent table its corresponding child tables are retried from table_list and they are updated accordingly. This prelocking work fine on master. On slave prelocking works for following cases. - Statement/mixed based replication - In row based replication when trigger execution is enabled through 'slave_run_triggers_for_rbr=YES/LOGGING/ENFORCE' Otherwise it results in an assert/crash, as the parent table will not find the corresponding child table and it will be NULL. Dereferencing NULL pointer leads to slave server exit. Fix: === Introduce a new 'slave_fk_event_map' flag similar to 'trg_event_map'. This flag will ensure that when foreign key is enabled in row based replication all the parent and child tables are prelocked, so that parent is able to locate the child table. Note: This issue is specific to slave, hence only slave needs to be upgraded.
* | | | Merge commit '10.4' into 10.5Oleksandr Byelkin2021-01-061-24/+12
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4bb-10.4-MDEV-23468Oleksandr Byelkin2020-12-251-24/+12
| |\ \ \ | | |/ /
| | * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-12-231-24/+12
| | |\ \ | | | |/
| | | * MDEV-24019 Assertion is hit for query using recursive CTE with no default DBIgor Babaev2020-12-081-24/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the query using a recursive CTE whose definition contained wildcard symbols in the recursive part was processed at the prepare stage an assertion was hit if the query was executed without any default database set. The failure happened when the function insert_fields() tried to check column privileges for the temporary table created for a recursive reference to the CTE. No acl checks are needed for any CTE. That's why this check should be blocked as well. The patch formulates a stricter condition at which this check is to be blocked that covers the case when a query using recursive CTEs is executed with no default database set. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | | * MDEV-24314 Unexpected error message when selecting from view that usesIgor Babaev2020-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mergeable derived table Do not check privileges for derived tables/CTEs and their fields. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-12-021-1/+4
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-12-011-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-12-011-1/+1
| | |\ \ | | | |/
| | | * MDEV 15532 Assertion `!log->same_pk' failed in row_log_table_apply_deleteMonty2020-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for the failure is that thd->mdl_context.release_transactional_locks() was called after commit & rollback even in cases where the current transaction is still active. For 10.2, 10.3 and 10.4 the fix is simple: - Replace all calls to thd->mdl_context.release_transactional_locks() with thd->release_transactional_locks(). The thd function will only call the mdl_context function if there are no active transactional locks. In 10.6 we will better fix where we will change the return value for some trans_xxx() functions to indicate if transaction did close the transaction or not. This will avoid the need of the indirect call. Other things: - trans_xa_commit() and trans_xa_rollback() will automatically call release_transactional_locks() if the transaction is closed. - We can't do that for the other functions as the caller of many of these are doing additional work (like close_thread_tables) before calling release_transactional_locks(). - Added missing abort_result_set() and missing DBUG_RETURN in select_create::send_eof() - Fixed wrong indentation in injector::transaction::commit()
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-11-031-1/+1
| |\ \ \ | | |/ /
* | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2020-11-011-1/+1
|\ \ \ \
| * \ \ \ Merge branch '10.3' into 10.4Oleksandr Byelkin2020-10-311-1/+1
| |\ \ \ \ | | |/ / / | |/| / / | | |/ /
| | * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-10-301-1/+1
| | |\ \ | | | |/
| | | * MDEV-22707 : galera got stuck after flush tablesJan Lindström2020-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | Remove unnecessary condition and add necessary include for non debug Galera library.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-10-301-0/+5
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-10-291-0/+5
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-10-281-0/+5
| | |\ \ | | | |/
| | | * MDEV-22707: galera got stuck after flush tablesmkaruza2020-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Deadlock is possible between applier thread and local committing thread with active FLUSH TABLE. Applier thread should skip table share checks and locks when opening table. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
* | | | MDEV-23691 S3 storage engine: delayed slave can drop the tableMonty2020-10-211-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixed the problems with S3 after the "DROP TABLE FORCE" changes. It also fixes all failing replication S3 tests. A slave is delayed if it is trying to execute replicated queries on a table that is already converted to S3 by the master later in the binlog. Fixes for replication events on S3 tables for delayed slaves: - INSERT and INSERT ... SELECT and CREATE TABLE are ignored but written to the binary log. UPDATE & DELETE will be fixed in a future commit. Other things: - On slaves with --s3-slave-ignore-updates set, allow S3 tables to be opened in read-write mode. This was done to be able to ignore-but-replicate queries like insert. Without this change any open of an S3 table failed with 'Table is read only' which is too early to be able to replicate the original query. - Errors are now printed if handler::extra() call fails in wait_while_tables_are_used(). - Error message for row changes are changed from HA_ERR_WRONG_COMMAND to HA_ERR_TABLE_READONLY. - Disable some maria_extra() calls for S3 tables. This could cause S3 tables to fail in some cases. - Added missing thr_lock_delete() to ma_open() in case of failure. - Removed from mysql_prepare_insert() the not needed argument 'table'.
* | | | Merge branch '10.4' into 10.5Sujatha2020-09-291-8/+18
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4Sujatha2020-09-281-0/+7
| |\ \ \ | | |/ /
| | * | MDEV-23823 Crash in SELECT NEXT VALUE on locked viewVladislav Vaintroub2020-09-281-0/+7
| | | | | | | | | | | | | | | | | | | | Make open_table() fail if sequence should be opened, but it turns out to be locked view.
| * | | MDEV-21470 ASAN heap-use-after-free in my_hash_sort_binMonty2020-09-251-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the server was calling virtual functions on a record that was not initialized with new data. This happened when fill_record() was aborted in the middle because an error in save_val() or save_in_field()
* | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2020-08-041-3/+2
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-031-9/+5
| |\ \ \ | | |/ /
| | * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-9/+5
| | |\ \ | | | |/
| | | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-9/+5
| | | |\
| | | | * cleanup: reduce code duplicationSergei Golubchik2020-07-291-8/+4
| | | | |
| | | | * MDEV-18496 Crash when Aria encryption is enabled but plugin not availableSergei Golubchik2020-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | wait_while_table_is_used() should return an error if handler::extra() fails
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-011-17/+26
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.3 into 10.4Marko Mäkelä2020-07-311-17/+26
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.2 into 10.3Marko Mäkelä2020-07-311-17/+26
| | |\ \ \ | | | |/ /
| | | * | MDEV-16039 Crash when selecting virtual columns generated using functions ↵Nikita Malyavin2020-07-211-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with DAYNAME() * Allocate items on thd->mem_root while refixing vcol exprs * Make vcol tree changes register and roll them back after the statement is executed. Explanation: Due to collation implementation specifics an Item tree could change while fixing. The tricky thing here is to make it on a proper arena. It's usually not a problem when a field is deterministic, however, makes a pain vice-versa, during allocation allocating. A non-deterministic field should be refixed on each statement, since it depends on the environment state. Changing the tree will be temporary and therefore it should be reverted after the statement execution.
* | | | | MDEV-23071 remove potentially dangerouws casting to Item_in_subselectOleksandr Byelkin2020-07-061-5/+6
| | | | | | | | | | | | | | | | | | | | Remove types casting with a help of virtual functions.
* | | | | introduce hton->drop_table() methodSergei Golubchik2020-07-041-14/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | first step in moving drop table out of the handler. todo: other methods that don't need an open table for now hton->drop_table is optional, for backward compatibility reasons
* | | | | MDEV-22881 Unexpected errors, corrupt output, Valgrind / ASAN errors in ↵Aleksey Midenkov2020-06-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Item_ident::print or append_identifier After this code end_inplace: if (thd->locked_tables_list.reopen_tables(thd, false)) goto err_with_mdl_after_alter; table is not reopened (need_reopen is false) but some_table_marked_for_reopen is reset to false. Item_field is allocated on table lock and assigned new name on first ALTER which is then freed at the end of the command. Second ALTER accessess this Item_field and gets garbage value.
* | | | | MDEV-19745 BACKUP STAGE BLOCK_DDL hangs on flush sequence tableMonty2020-06-141-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem was that FLUSH TABLES where trying to read latest sequence state which conflicted with a running ALTER SEQUENCE. Removed the reading of the state, when opening a table for FLUSH, as it's not needed in this case. Other thing: - Fixed a potential issue with concurrently running ALTER SEQUENCE where the later ALTER could potentially read old data
* | | | | remove dead codeSergei Golubchik2020-06-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reduce the amount of engine-specific code in the server, particularly as it does not serve any purpose now. may be needed for VP engine, to be reconsidered in MDEV-7795
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-06-051-6/+7
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.3 into 10.4Marko Mäkelä2020-06-051-4/+4
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.2 into 10.3Marko Mäkelä2020-06-051-4/+4
| | |\ \ \ | | | |/ /
| | | * | MDEV-22339 - Assertion `str_length < len' failedSergey Vojtovich2020-06-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When acquiring SNW/SNRW/X MDL lock DDL/admin statements may abort pending thr lock in concurrent connection with open HANDLER (or delayed insert thread). This may lead to a race condition when table->alias is accessed concurrently by such threads. Either assertion failure or memory leak is a practical consequence of this race condition. Specifically HANDLER is opening a table and issuing alias.copy(), while DDL executing get_lock_data()/alias.c_ptr()/realloc()/realloc_raw(). Fixed by perforimg table->init() before it is published via thd->open_tables.
* | | | | MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait foreverKentoku SHIBA2020-06-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add looping check Conflicts: sql/table.h