summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-21580: Allow packed sort keys in sort bufferbb-10.5-mdev6915-extVarun Gupta2020-03-1023-296/+2069
| | | | | | | | | | | | | | | | This task deals with packing the sort key inside the sort buffer, which would lead to efficient usage of the memory allocated for the sort buffer. The changes brought by this feature are 1) Sort buffers would have sort keys of variable length 2) The format for sort keys inside the sort buffer would look like |<sort_length><null_byte><key_part1><null_byte><key_part2>.......| sort_length is the extra bytes that are required to store the variable length of a sort key. 3) When packing of sort key is done we store the ORIGINAL VALUES inside the sort buffer and not the STRXFRM form (mem-comparable sort keys). 4) Special comparison function packed_keys_comparison() is introduced to compare 2 sort keys.
* MDEV-21833 Make slave_run_triggers_for_rbr enforce triggers to run on slave, ↵Oleksandr Byelkin2020-03-098-23/+278
| | | | | | | | even when there are triggers on the master A bit changed patch of Anders Karlsson with examples added. New parameters "ENFORCE" to slave-run-triggers-for-rbr added.
* Fixed signed/unsigned error on WindowsSergey Vojtovich2020-03-091-1/+2
|
* MDEV-21659 XA rollback foreign_xid is allowed inside active XAAndrei Elkin2020-03-093-4/+84
| | | | | | | | | | MDEV-21854 xa commit `xid` one phase for already prepared transaction must always error out Added state and one-phase option checks to XA "external" commit/rollback branches. While the XA standard does not prohibit it, Commit and Rollback of an XA external to the current ongoing transaction is not allowed; after all the current transaction may rollback to not being able to revert that decision.
* Attempt fixing build failure on WindowsSergey Vojtovich2020-03-091-2/+2
| | | | Let ulong_num being converted by strtoul() rather than strtol().
* MDEV-21856 - xid_t::formatID has to be constrained to 4 byte sizeSergey Vojtovich2020-03-093-1/+15
| | | | | | Engine (InnoDB) and XA replication MDEV-742 requires the XID member be of a constant minimum across supported platform ulong size which is 4 bytes.
* MDEV-21893: Assertion failure on upgrade with innodb_encrypt_logMarko Mäkelä2020-03-091-2/+1
| | | | | | recv_log_recover_10_4(): Add a missing bit pattern negation that was forgotten when commit f8a9f906679e1d1ab026c245f7d24c652050d8b3 (MDEV-12353) removed the support for crash-upgrading.
* MDEV-21892: Assertion ...row_get_rec_trx_id... failed on SELECTMarko Mäkelä2020-03-093-9/+47
| | | | | | | | | btr_cur_upd_rec_in_place(): Invoke page_zip_rec_set_deleted() for ROW_FORMAT=COMPRESSED pages, so that the change will be written to the redo log. This part of crash recovery was broken in commit 08ba388713946c03aa591899cd3a446a6202f882 (MDEV-12353).
* Cleanup: Remove recv_sys.remove_extra_log_filesMarko Mäkelä2020-03-073-22/+8
| | | | | | | create_log_file(): Delete all old redo log files where they used to be deleted, after the crash injection point innodb_log_abort_6, before commit 9ef2d29ff44de2013c95666a011b993e5c2e5674 deprecated and ignored the setting innodb_log_files_in_group.
* Cleanup: log upgrade and encryptionMarko Mäkelä2020-03-075-124/+84
| | | | | | | | | | | | | | | | log_crypt_101_read_checkpoint(), log_crypt_101_read_block(): Declare as ATTRIBUTE_COLD. These are only used when checking that a MariaDB 10.1 encrypted redo log is clean. log_block_calc_checksum_format_0(): Define in the only compilation unit where it is needed. This is only used when reading the checkpoint information from redo logs before MariaDB 10.2.2. crypt_info_t: Declare the byte arrays directly with alignas(). log_crypt(): Use memcpy_aligned instead of reinterpret_cast on integers.
* Cleanup: Remove recv_sys.buf_sizeMarko Mäkelä2020-03-072-16/+15
| | | | Also, correctly document what recv_sys.mutex is protecting.
* Basic LEX::print function that supports UPDATEsSergei Petrunia2020-03-072-0/+65
|
* Provide a show_create_table_ex() functionSergei Petrunia2020-03-072-27/+62
| | | | | It is like show_create_table() but allows the caller to specify the database_name and table_name which are to be printed.
* MDEV-21887: federatedx crashes on SELECT ... INTO query in select_handler codeSergei Petrunia2020-03-074-26/+58
| | | | | | | | | | - Don't try to push down SELECTs that have a side effect - In case the storage engine did support pushdown of SELECT with an INTO clause, write the rows we've got from it into select->join->result, and not thd->protocol. This way, SELECT ... INTO ... FROM smart_engine_table will put the result into where instructed, and NOT send it to the client.
* MDEV-14425 preparation: Simplify redo log upgradeMarko Mäkelä2020-03-061-124/+101
| | | | | recv_log_recover_pre_10_2(): Merged from recv_find_max_checkpoint_0(), recv_log_format_0_recover().
* MDEV-14425 Cleanup: Use std::atomic for some log_sys membersMarko Mäkelä2020-03-0515-310/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some fields were protected by log_sys.mutex, which adds quite some overhead for readers. Some readers were submitting dirty reads. log_t::lsn: Declare private and atomic. Add wrappers get_lsn() and set_lsn() that will use relaxed memory access. Many accesses to log_sys.lsn are still protected by log_sys.mutex; we avoid the mutex for some readers. log_t::flushed_to_disk_lsn: Declare private and atomic, and move to the same cache line with log_t::lsn. log_t::buf_free: Declare as size_t, and move to the same cache line with log_t::lsn. log_t::check_flush_or_checkpoint_: Declare private and atomic, and move to the same cache line with log_t::lsn. log_get_lsn(): Define as an alias of log_sys.get_lsn(). log_get_lsn_nowait(), log_peek_lsn(): Remove. log_get_flush_lsn(): Define as an alias of log_sys.get_flush_lsn(). log_t::initiate_write(): Replaces log_buffer_sync_in_background().
* use O_DSYNC for InnoDBEugene Kosov2020-03-052-8/+7
| | | | | | | O_DSYNC is faster than O_SYNC because it syncs as little as needed (e.g. no timestamp changes) This change is similar to change fsync() -> fdatasync() in MDEV-21382
* MDEV-14918: Use sst_dump from package rocksdb-tools, don't build itOtto Kekäläinen2020-03-054-2/+13
| | | | | | | | | | | | | | | Since this tool is already shipped in the system, don't provide it from MariaDB from 10.5 series onwards. It will potentially just create an installation failure due to conflict if users install rocksdb-tools. Package rocksdb-tools in Debian since Buster (10): https://packages.debian.org/search?suite=buster&arch=any&mode=path&searchon=contents&keywords=sst_dump Package rocksdb-tools in Ubuntu since Disco (19.04): https://packages.ubuntu.com/search?suite=disco&arch=any&mode=exactfilename&searchon=contents&keywords=sst_dump This change is adopted from Debian the change has been since Dec 18, 2018. https://salsa.debian.org/mariadb-team/mariadb-10.3/-/commit/d50e2eaf1fad46c494bd0f090b0e75c19ac3f41a
* MDEV-17367: Move my_print_defaults and *.sql to mariadb-server-coreOtto Kekäläinen2020-03-053-9/+11
| | | | | | | | | | | | | | | | | The command is needed to install/upgrade databases. It should therefore reside in the server-core package, as that package is supposed to contain all necessary tools to start and run the database (although manually, there are no automation or service scripts included in server-core by design). Also add Breaks+Replaces in the control so upgrades will not complain about overwriting files in previously installed packages of different name. This was adopted from Debian where this change has been since Nov 4, 2018. https://salsa.debian.org/mariadb-team/mariadb-10.1/-/commit/3689350ad30916aa68fe2c1b35c290fb5095bc9b In addition, also move all *.sql files referenced mysql_install_db for the same reasons.
* MDEV-14425: Remove the unused function mtr_write_log()Marko Mäkelä2020-03-052-25/+0
| | | | This amends commit 37e7bde12abddcda4d5505450e39a739561bd4d5
* MDEV-14425 preparation: Provide ut_crc32_low()Marko Mäkelä2020-03-052-113/+84
| | | | | | | | | | | | | | | | | The ut_crc32() function uses a hard-coded initial CRC-32C value of 0. Replace it with ut_crc32_low(), which allows to specify the initial checksum value, and provide an inlined compatibility wrapper ut_crc32(). Also, remove non-inlined wrapper functions on ARMv8 and POWER8, and remove dead code (the generic implementation) on POWER8. Note: The original AMD64 instruction set architecture in 2003 only included SSE2. The CRC-32C instructions are part of the SSE4.2 instruction set extension for IA-32 and AMD64, with first processors released in November 2007 (using the AMD Barcelona microarchitecture) and November 2008 (Intel Nehalem microarchiteture). It might be safe to assume that SSE4.2 is available on all currently used AMD64 based systems, but we are not taking that step yet.
* Remove some redundant code flagged by clang or GCCMarko Mäkelä2020-03-052-2/+1
|
* MDEV-21870 Deprecate and ignore innodb_scrub_log and innodb_scrub_log_speedMarko Mäkelä2020-03-0411-175/+43
| | | | | | | | | | | | | The configuration parameter innodb_scrub_log never really worked, as reported in MDEV-13019 and MDEV-18370. Because MDEV-14425 is changing the redo log format, the innodb_scrub_log feature would have to be adjusted for it. Due to the known problems, it is easier to remove the feature for now, and to ignore and deprecate the parameters. If old log contents should be kept secret, then enabling innodb_encrypt_log or setting a smaller innodb_log_file_size could help.
* MDEV-21228: mariadb-conv man pageIan Gilfillan2020-03-042-1/+105
|
* MDEV-18214 cleanup: Remove redundant MONITOR_INC callsMarko Mäkelä2020-03-042-6/+0
| | | | | | | MONITOR_PENDING_CHECKPOINT_WRITE and MONITOR_LOG_IO track log_sys.n_pending_checkpoint_writes and log_sys.n_log_ios, respectively. The MONITOR_INC calls are redundant, because the values will be overwritten in srv_mon_process_existing_counter().
* Cleanup: Make MONITOR_LSN_CHECKPOINT_AGE a value.Marko Mäkelä2020-03-047-15/+11
| | | | | | | Compute MONITOR_LSN_CHECKPOINT_AGE on demand in srv_mon_process_existing_counter(). This allows us to remove the overhead of MONITOR_SET calls for the counter.
* MDEV-14425 preparation: Remove log_header_read()Marko Mäkelä2020-03-044-26/+9
| | | | | | | | | | | | The function log_header_read() was only used during server startup, and it will mostly be used only for reading checkpoint information from pre-MDEV-14425 format redo log files. Let us replace the function with more direct calls, so that it is clearer what is going on. It is not strictly necessary to hold any mutex during this operation, and because there will be only a limited number of operations during early server startup, it is not necessary to increment any I/O counters.
* MDEV-14425 preparation: Remove log_t::append_on_checkpointMarko Mäkelä2020-03-0315-430/+19
| | | | | | | | | | | | | | | | | | Simplify the logging of ALTER TABLE operations, by making use of the TRX_UNDO_RENAME_TABLE undo log record that was introduced in commit 0bc36758ba08ddeea6f7896a0fb815a13a48895a. commit_try_rebuild(): Invoke row_rename_table_for_mysql() and actually rename the files before committing the transaction. fil_mtr_rename_log(), commit_cache_rebuild(), log_append_on_checkpoint(), row_merge_rename_tables_dict(): Remove. mtr_buf_copy_t, log_t::append_on_checkpoint: Remove. row_rename_table_for_mysql(): If !use_fk, ignore missing foreign keys. Remove a call to dict_table_rename_in_cache(), because trx_rollback_to_savepoint() should invoke the function if needed.
* MDEV-21534: Fix -Wmaybe-uninitializedMarko Mäkelä2020-03-031-7/+7
| | | | | group_commit_lock::release(): Ensure that prev will be initialized, simplify a comparison, and fix some white space.
* MDEV-21724: Correctly invoke page_dir_split_slot()Marko Mäkelä2020-03-031-24/+36
| | | | | | | | | | | | | | | In commit 138cbec5f2300bd5b401e83802642c1806264992, we computed an incorrect parameter to page_dir_split_slot(), leading us to splitting the wrong directory slot, or an out-of-bounds access when splitting the supremum slot. This was once caught in the test innodb_gis.kill_server for inserting records to a clustered index root page. page_dir_split_slot(): Take the slot as a pointer, instead of a numeric index. page_apply_insert_redundant(), page_apply_insert_dynamic(): Rename slot to last_slot, and make owner_slot a pointer.
* MDEV-12353: Introduce an EXTENDED record subtype TRIM_PAGESMarko Mäkelä2020-03-037-85/+55
| | | | | | | | | | | | | | | | | | | | | | | | For undo log truncation, commit 055a3334adc004bd3a897990c2f93178e6bb5f90 repurposed the MLOG_FILE_CREATE2 record with a nonzero page size to indicate that an undo tablespace will be shrunk in size. In commit 7ae21b18a6b73bbc3bf1ff448faf60c29ac1d386 the MLOG_FILE_CREATE2 record was replaced by a FILE_CREATE record. Now that the redo log encoding was changed, there is no actual need to write a file name in the log record; it suffices to write the page identifier of the first page that is not part of the file. This TRIM_PAGES record could allow us to shrink any data files in the future. For now, it will be limited to undo tablespaces. mtr_t::log_file_op(): Remove the parameter first_page_no, because it would always be 0 for file operations. mtr_t::trim_pages(): Replaces fil_truncate_log(). mtr_t::log_write(): Avoid same_page encoding if !bpage&&!m_last. fil_op_replay_rename(): Remove the constant parameter first_page_no=0.
* MDEV-20500: Bad error msg on disabling local infileRahul Anand2020-03-034-5/+9
|
* Merge pull request #1434 from citrus-it/illumos-auth-socketAndy Fiddaman2020-03-032-1/+45
| | | MDEV-21476: auth_socket: add support for illumos with getpeerucred()
* MDEV-21747 needless alter_ctx arg in prep_alter_part_table()Aleksey Midenkov2020-03-033-6/+3
|
* MDEV-7318 RENAME INDEXAleksey Midenkov2020-03-0313-2/+2204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support of RENAME INDEX operation to the ALTER TABLE statement. Code which determines if ALTER TABLE can be done in-place for "simple" storage engines like MyISAM, Heap and etc. was updated to handle ALTER TABLE ... RENAME INDEX as an in-place operation. Support for in-place ALTER TABLE ... RENAME INDEX for InnoDB was covered by MDEV-13301. Syntax changes ============== A new type of <alter_specification> is added: <rename index clause> ::= RENAME ( INDEX | KEY ) <oldname> TO <newname> Where <oldname> and <newname> are identifiers for old name and new name of the index. Semantic changes ================ The result of "ALTER TABLE t1 RENAME INDEX a TO b" is a table which contents and structure are identical to the old version of 't1' with the only exception index 'a' being called 'b'. Neither <oldname> nor <newname> can be "primary". The index being renamed should exist and its new name should not be occupied by another index on the same table. Related to: WL#6555, MDEV-13301
* MDEV-16290 ALTER TABLE ... RENAME COLUMN syntaxAleksey Midenkov2020-03-0310-34/+656
| | | | | | | | | | | | | | | | | | | | | | | | | | The existing syntax for renaming a column uses "ALTER TABLE ... CHANGE" command. This requires full column specification to rename the column. This patch adds new syntax "ALTER TABLE ... RENAME COLUMN", which do not expect users to provide full column specification. It means that the new syntax would pick in-place or copy algorithm in the same way as that of existing "ALTER TABLE ... CHANGE" command. The existing syntax "ALTER TABLE ... CHANGE" will continue to work. Syntax changes ============== ALTER TABLE tbl_name [alter_specification [, alter_specification] ...] [partition_options] Following is a new <alter_specification> added: | RENAME COLUMN <oldname> TO <newname> Where <oldname> and <newname> are identifiers for old name and new name of the column. Related to: WL#10761
* Fix build on aarch64, after MDEV-21534Vladislav Vaintroub2020-03-021-0/+1
| | | | MY_RELAX_CPU on this arch needs int32, defined in my_global.h
* Cleanup: Remove srv_start_lsnMarko Mäkelä2020-03-028-30/+19
| | | | Most of the time, we can refer to recv_sys.recovered_lsn.
* MDEV-12353 cleanup: Simplify mtr_t::undo_append()Marko Mäkelä2020-03-021-3/+1
|
* MDEV-14479: Do not acquire InnoDB record locks when covering table locksVlad Lesin2020-03-023-3/+209
| | | | | | | exist lock_rec_lock() does not set record lock if table lock is stronger or equal to the acquired record lock.
* MDEV-21534 - fix debug buildVladislav Vaintroub2020-03-011-1/+1
|
* MDEV-21534 - Improve innodb redo log group commit performancebb-10.5-MDEV-21534Vladislav Vaintroub2020-03-018-161/+499
| | | | | | | | | Introduce special synchronization primitive group_commit_lock for more efficient synchronization of redo log writing and flushing. The goal is to reduce CPU consumption on log_write_up_to, to reduce the spurious wakeups, and improve the throughput in write-intensive benchmarks.
* MDEV-21766 - Forbid XID with empty 'gtrid'Sergey Vojtovich2020-02-284-3/+61
| | | | | | | | | XA specification doesn't permit empty gtrid. It is now enforced by this patch. This solution was agreed in favour of fixing InnoDB, which doesn't expect empty XID since early 10.5. Also fixed wrong assertion (and added a test cases) that didn't permit 64 bytes gtrid + 64 bytes bqual.
* MDEV-21704 Add a new JSON field "version_id" into mysql.global_priv.privAlexander Barkov2020-02-289-23/+340
|
* MDEV-21838: Add information about packed addon fields in ANALYZE FORMAT=JSON10.5-mdev21784-reg1-baseVarun Gupta2020-02-287-1/+129
| | | | | It is useful to know whether sorting uses addon fields[packed|unpacked] or ROWID. Provide this information in ANALYZE FORMAT=JSON output.
* Fix GCC -Wsign-compareMarko Mäkelä2020-02-271-1/+2
|
* Fix GCC -WparenthesesMarko Mäkelä2020-02-271-1/+1
|
* MDEV-21724: Optimize page_cur_insert_low() redo loggingMarko Mäkelä2020-02-275-220/+1059
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inserting a record into an index page involves updating multiple fields in the page header as well as updating the next-record links and potentially updating fields related to the sparse page directory. Let us cover the insert operations by higher-level log records, to avoid 'redundant' logging about the writes. The code for applying the high-level log records will check the consistency of the page thoroughly, to avoid crashes during recovery. We will refuse to replay the inserts if any inconsistency is detected. With innodb_force_recovery=1, recovery will continue, but the affected pages may be more inconsistent if some changes were omitted. mrec_ext_t: Introduce the EXTENDED record subtypes INSERT_HEAP_REDUNDANT, INSERT_REUSE_REDUNDANT, INSERT_HEAP_DYNAMIC, INSERT_REUSE_DYNAMIC. The record will explicitly identify the page type and whether the space will be allocated from PAGE_HEAP_TOP or reused from the PAGE_FREE list. It will also tell how many bytes to copy from the preceding record header and payload, and how to initialize the rest of the record header and payload. mtr_t::page_insert(): Write the high-level log records. log_phys_t::apply(): Parse the high-level log records. page_apply_insert_redundant(), page_apply_insert_dynamic(): Apply the high-level log records. page_dir_split_slot(): Introduce a variant that does not write log nor deal with ROW_FORMAT=COMPRESSED pages. page_mem_alloc_heap(): Remove the mtr_t parameter page_cur_insert_rec_low(): Write log only via mtr_t::page_insert().
* MDEV-12353 Cleanup: Remove page_rec_get_base_extra_size()Marko Mäkelä2020-02-272-24/+0
| | | | | The function page_rec_get_base_extra_size() became dead code in commit 08ba388713946c03aa591899cd3a446a6202f882.
* MDEV-12353: Improve page_cur_delete_rec() recoveryMarko Mäkelä2020-02-273-13/+24
| | | | | | | | | This is a follow-up to commit 572d20757be38157fa2309c35efdec19e68087f1 where we introduced the EXTENDED log record subtypes DELETE_ROW_FORMAT_REDUNDANT and DELETE_ROW_FORMAT_DYNAMIC. log_phys_t::apply(): If corruption was noticed, stop applying the log unless innodb_force_recovery is set.