- 23 Aug, 2023 3 commits
-
-
Alexander Barkov authored
- Moving some of Database_qualidied_name methods into a new class Identifier_chain2. - Changing the data type of the following variables from Database_qualified_name to Identifier_chain2: * q_pkg_proc in LEX::call_statement_start() * q_pkg_func in LEX::make_item_func_call_generic() Rationale: The data type of Database_qualified_name::m_db will be changed to Lex_ident_db soon. So Database_qualified_name won't be able to store the `pkg.routine` part of `db.pkg.routine` any more, because `pkg` must not depend on lower-case-table-names.
-
Alexander Barkov authored
- Changing the data type of the global variable any_db from LEX_CSTRING to Lex_ident_db - Removing the dependency on system_charset_info from Lex_ident_fs::check_body(), using my_charset_utf8mb3_general_ci directly, because system_charset_info is initialized much later than any_db. system_charset_info cannot be changed dynamically any way. - Removing the unsed old code from Lex_ident_fs::check_body(). This code was last used in MySQL-4.0 and won't be used in the future.
-
Alexander Barkov authored
- Replacing the old style inplace check_db_name() in make_table_name_list() to the new style non-modifying code - Adding "const" qualifier to the "db" parameter to ha_discover_table_names() and its dependency functions.
-
- 22 Aug, 2023 2 commits
-
-
Alexander Barkov authored
- Adding a new class Lex_ident_db, to store normalized database names: lower-cased if lower-case-table-name says so, and checked to be a valid database name using Lex_ident_fs::check_db_name() - Reusing the new class in parameters to functions: prepare_db_action() mysql_create_db() mysql_alter_db() mysql_rm_db() mysql_upgrade_db() This change removed two old-style check_db_name() calls.
-
Alexander Barkov authored
- Changing the global function ok_for_lower_case_names() into a method in class Lex_ident_fs. - Changing a few functions/methods to get the database name as a "const LEX_CSTRING" instead of a "const char *". All these functions/methods use ok_for_lower_case_names() inside. This change helps to avoid new strlen() calls, and also removes a few old strlen() calls.
-
- 21 Aug, 2023 2 commits
-
-
Alexander Barkov authored
The function normalize_db_name() fully repeated the functionality of the class DBNameBuffer. This patch removes normalize_db_name() and replaces it to a DBNameBuffer based code.
-
Alexander Barkov authored
Changing LEX_CSTRING* parameters of LEX::make_sp_name() to Lex_ident_sys_st. This makes the code clear because a value of Lex_ident_sys_st has some guaranteed additional constraints over a base LEX_CSTRING: - Its LEX_CSTRING::str is not NULL (sql_yacc.yy would abort otherwise) - Its LEX_CSTRING::str is 0-terminated - Its a valid utf8 string - The string pointed by LEX_CSTRING::str was created on THD::mem_root Also changing "pass by pointer" to "pass by reference", as these parameters can never be NULL - they are Bison stack variables.
-
- 18 Aug, 2023 3 commits
-
-
Alexander Barkov authored
- Adding a class Lex_ident_fs, to store identifiers for on-disk database objects, such as databases, tables, triggers. - Moving the validation code from check_db_name() to non-modifying methods in Lex_ident_fs: Lex_ident_fs::check_body() Lex_ident_fs::check_db_name() Adding a new method Lex_ident_fs::check_db_name_with_error(), which performs validation and raises an error on validation failure. Unlike the old function check_db_name(), the new class Lex_ident_fs does not lower-case the identifier during the validation. Lower-casing must be done before calling Lex_ident_fs validation methods. - Adding a low level helper template class CharBuffer which can: * store exact or lower-cased strings with a short fixed maximum length * return the value as a LEX_CSTRING efficiently - Adding a helper template class DBNameBuffer (deriving from CharBuffer), to allocate optionally lower-cased database identifiers on stack when relevant. Useful for temporary values which don't need to be allocated on MEM_ROOT. - Using DBNameBuffer in mysql_change_db() - Using DBNameBuffer in show_create_db()
-
Alexander Barkov authored
- Renaming the parameter `check_for_path_char` to a more self-descriptive `disallow_path_chars` - Renaming the variable `name_length` in check_table_name() to a more self-descriptive `char_length`. - Fix the `while` loop in check_table_name() into a `for` loop and replace multiple {{char_length++}} (the former {{name_length++}}) statements to a signle increment statement in the `for` loop header.
-
Alexander Barkov authored
-
- 17 Aug, 2023 1 commit
-
-
Junqi Xie authored
MariaRocks is currently lagging behind the main branch of the RocksDB engine. This commit brings MariaRocks up to date with the latest release of RocksDB by backporting changes from Facebook’s MyRocks. These changes include API updates, bug fixes, and improvements for compatibility with RocksDB v8.1.1. Some system variables and metadata tables are modified to reflect the internal changes in RocksDB. Additionally, this commit backports improved and more stable test cases from Facebook’s MyRocks, including tests for the write_unprepared isolation level of RocksDB. It also reverts workarounds for MDEV-29875 and MDEV-31057 and adds support for the latest compilation options. The default value of the following system variables are changed: * rocksdb_stats_level: 1 (kExceptHistogramOrTimers) * rocksdb_wal_recovery_mode: 2 (kPointInTimeRecovery) The following system variables are added: * rocksdb_cancel_manual_compactions * rocksdb_enable_iterate_bounds * rocksdb_enable_pipelined_write * rocksdb_enable_remove_orphaned_dropped_cfs * rocksdb_manual_compaction_bottommost_level * rocksdb_max_background_compactions * rocksdb_max_background_flushes * rocksdb_max_bottom_pri_background_compactions * rocksdb_skip_locks_if_skip_unique_check * rocksdb_track_and_verify_wals_in_manifest * rocksdb_write_batch_flush_threshold The following system variables are deprecated: * rocksdb_hash_index_allow_collision * rocksdb_new_table_reader_for_compaction_inputs The following dynamic metadata table is added: * INFORMATION_SCHEMA.ROCKSDB_LIVE_FILES_METADATA The following status variables are added: * rocksdb_manual_compactions_cancelled * rocksdb_manual_compactions_pending The following status variables are removed: * rocksdb_block_cache_filter_bytes_evict * rocksdb_block_cache_index_bytes_evict * rocksdb_block_cachecompressed_hit * rocksdb_block_cachecompressed_miss * rocksdb_no_file_closes * rocksdb_num_iterators * rocksdb_number_deletes_filtered * rocksdb_write_timedout
-
- 16 Aug, 2023 1 commit
-
-
Sergei Golubchik authored
-
- 15 Aug, 2023 28 commits
-
-
Nikita Malyavin authored
Add LOCK_ALTER_TABE_COPY bit to old_mode. Disables online copy by default, but still allows to force it with explicit lock=none
-
Nikita Malyavin authored
... upon replicating online ALTER When an online event is applied and slave_exec_mode is idempotent, Write_rows_log_event::do_before_row_operations had reset thd->lex->sql_command to SQLCOM_REPLACE. This led to that a statement was detected as a row-type during binlogging, and was logged as not standalone. So the corresponding Gtid_log_event, when applied on replica, did not exit early and created a new PSI transaction. Hence the difference with non-online ALTER.
-
Nikita Malyavin authored
Pack these fields together: event_owns_temp_buf cache_type slave_exec_mode checksum_alg Make them bitfields to fit a single 2-byte hole. This saves 24 bytes per event. SLAVE_EXEC_MODE_LAST_BIT is rewritten as > SLAVE_EXEC_MODE_LAST= SLAVE_EXEC_MODE_IDEMPOTENT to avoid a false-positive -Wbitfield-enum-conversion warning: Bit-field 'slave_exec_mode' is not wide enough to store all enumerators of 'enum_slave_exec_mode'.
-
Nikita Malyavin authored
Replica honors its own binlog_row_image value when it sets up read_set. When a slave thread is applying replicated row events in parallel with the running online alter, we need all columns to be read from the table (for the online alter logged row event) not only those that were present in the pre-image for the replicated row event. Avoid shrinking the set when online alter is running, i.e. leave it all set
-
Nikita Malyavin authored
s3 is read-only. No need to update to a read-only engine with LOCK=NONE.
-
Nikita Malyavin authored
Forbid Online for CONNECT.
-
Nikita Malyavin authored
Adding an auto_increment column online leads to an undefined behavior. Basically any DEFAULTs that depend on a row order in the table, or on the non-deterministic (in scope of the ALTER TABLE statement) function is UB. For example, NOW() is considered generally non-deterministic (Item_func_now_utc is marked with VCOL_NON_DETERMINISTIC), but it's fixed in scope of a single statement. Same for any other function that depends only on the session/status vars apart from its arguments. Only two UB cases are known: * adding new AUTO_INCREMENT column. Modifying the existing column may be fine under certain circumstances, see MDEV-31058. * adding new column with DEFAULT(nextval(...)). Modifying the existing column is possible, since its value will be always present in the online event, except for the NULL -> NOT NULL modification
-
Nikita Malyavin authored
Add a new virtual function that will increase the inserted rows count for the insert log event and decrease it for the delete event. Reuses Rows_log_event::m_row_count on the replication side, which was only set on the logging side.
-
Nikita Malyavin authored
Forbid online for sequences. It doesn't work now and sequence tables are always only one row, so not worth the extra complexity.
-
Nikita Malyavin authored
-
Nikita Malyavin authored
-
Andrei authored
The deadlock was caused by too strong MDL acquired by the start ALTER. Replica's ALTER TABLE replication consists of two phases: 1. Start ALTER (SA) -- the event is emittd in the very beginning, allowing replication start ALTER in parallel 2. Commit ALTER (CA) -- ensures that master finishes successfully CA is normally received by wait_for_master call. If parallel DML was run, the following sequence will take place: |- SA |- DML |- CA If CA is handled after MDL upgrade, it'll will deadlock with DML. While MDL is shared by the start ALTER wait for its 2nd part to allow concurrent DMLs to grab the lock. The fix uses wait_for_master reentrancy -- no need to avoid a second call in the end of mysql_alter_table. Since SA and CA are marked with FL_DDL, the DML issued in-between cannot be rescheduled before or after them. However, SA "commits" (by he call of write_bin_log_start_alter and, subsequently, thd->wakeup_subsequent_commits) before the copy stage begins, unlocking the DMLs to run on this table. That is, these DMLs will be executed concurrently with the copy stage, making Online alter effective on replicas as well Co-authored-by: Nikita Malyavin (nikitamalyavin@gmail.com)
-
Nikita Malyavin authored
-
Nikita Malyavin authored
Make binlog_prepare_row_images accept image type as an argument.
-
Nikita Malyavin authored
-
Nikita Malyavin authored
1. Make online disk writes unlimited, same as filesort does. 2. Make proper error handling -- in 32-bit build IO_CACHE capacity limit is 4GB, so it is quite possible to overfill there. 3. Event_log::write_cache complicated with event reparsing, and as it was proven by QA, contains some mistakes. Rewrite introbuce a simpler and much faster version, not featuring reparsing and therefore copying a whole buffer at once. This also disables checksums and crypto. 4. Handle read_log_event errors correctly: error returned is -1 (eof signal for alter table), and my_error is not called. Call my_error and always return 1. There's no test for this, since it shouldn't happen, see the next bullet. 5. An event could be written partially in case of error, if it's bigger than the IO_CACHE buffer. Restore the position where it was before the error was emitted. As a result, online alter is untied of several binlog variables, which was a second aim of this patch.
-
Nikita Malyavin authored
Report correct algorithm in the error message.
-
Nikita Malyavin authored
Don't skip row_end if it wasn't set explicitly. Also another segfault was caused by accessing rpl_write_set on slave during the row update/delete. The reason was a default_column_bitmaps() call, which also sets rpl_write_set to NULL. Previously, the related behavior was changed in commit afd3ee97ad, where one such call was removed from Update_rows_log_event::do_exec_row, but the same one was mistakenly left in Delete_rows_log_event. Now it's also removed.
-
Nikita Malyavin authored
The correct (best) algorithm is now chosen for ALGORITHM=DEFAULT and alter_algorithm=DEFAULT See also MDEV-30906
-
Nikita Malyavin authored
Group all the checks in online_alter_check_supported(). There is now two groups of checks: 1. A technical availability of online, that is checked before open_tables, and affects table_list->lock_type. It's supposed to be safe to make it TL_READ even if COPY algorithm will fall back to not-online, since MDL is SHARED_UPGRADEABLE anyway. 2. An 'online' availability for a COPY algorithm. It can be done as late as just before the copy_data_between_tables call. The lock_type influence is disclosed above, so the only other place it affects is Alter_info::supports_lock, where `online` flag is only used to decide whether to report the error at the inplace preparation stage. We'd want to make that at the last resort, which is COPY preparation, if no algorithm is chosen by the user. So it's event better now. Some changes are required to the autoinc support detection, as the check now happens after mysql_prepare_alter_table: * alter_info->drop_list is empty * instead, dropped columns are in tmp_set * alter_info->create_list now has every field that's in the new table. * the column definition's change.str will be nonnull whether the column remains in the new table (vs whether it was changed, as before). But it also has `field` field set. * IF EXISTS doesn't have to be dealt anymore This infers that the changes are now checked in more detail: a field's definition shouldn't be changed, vs a field shouldn't be mentioned in the CHANGE list, as it was before. This is reflected by the line 193 test.
-
Nikita Malyavin authored
-
Nikita Malyavin authored
Also update abi declarations. The abi itself is unchanged, since const doesn't affect C-style exported name.
-
Nikita Malyavin authored
disabie view-protocol for certain places: 1. While a transaction is in progress: a view gets locked for a transaction duration, so DROP VIEW from a servicing conneciton deadlocks. We can't just disable servicing connection, as CREATE VIEW and DROP VIEW commit implicitly. 2. For querying Opened_table_definitions: the actual query executed is `SELECT * FROM mysqltest_tmp_v`, then the view is dropped
-
Nikita Malyavin authored
Skip more rpl-related error handling. Also move the error check inside if (table) -- otherwise the error should be handled already.
-
Nikita Malyavin authored
Online alter and replication paths differ quite noticeably. It's time to fix the mess. Online alter has to unpack the old table's data (here conv_table), and then convert, while replication requires more sophisticated track: handle possible conversions, treat extra replica fields, and carefully deduce master's record length. * Extract unpack_field. * handle the unpacking progress through a state machine presented by Unpack_record_state struct. * Stick most of the online alter unpacking together under a single conditional branch.
-
Nikita Malyavin authored
-
Nikita Malyavin authored
When column is changed to autoinc, ALTER TABLE may update zero/NULL values, if NO_AUTO_VALUE_ON_ZERO mode is not enabled. Forbid this for LOCK=NONE for the unreliable cases. The cases are described in online_alter_check_autoinc.
-
Nikita Malyavin authored
-