- 16 Dec, 2016 3 commits
-
-
Marko Mäkelä authored
Thanks to Zhangyuan from Alibaba for pointing out this bug. btr_page_empty(): When a clustered index root page is emptied, preserve PAGE_ROOT_AUTO_INC. This would occur during a page split. page_create_empty(): Preserve PAGE_ROOT_AUTO_INC when a clustered index root page becomes empty. Use a faster method for writing the field. page_zip_copy_recs(): Reset PAGE_MAX_TRX_ID when copying clustered index pages. We must clear the field when the root page was a leaf page and it is being split, so that PAGE_MAX_TRX_ID will continue to be 0 in clustered index non-root pages. page_create_zip(): Add debug assertions for validating PAGE_MAX_TRX_ID and PAGE_ROOT_AUTO_INC.
-
Marko Mäkelä authored
Remove unnecessary restarts by testing multiple tables across a restart. This change almost halves the execution time. Some further restarts could be removed with additional effort.
-
Marko Mäkelä authored
This should be functionally equivalent to WL#6204 in MySQL 8.0.0, with the notable difference that the file format changes are limited to repurposing a previously unused data field in B-tree pages. For persistent InnoDB tables, write the last used AUTO_INCREMENT value to the root page of the clustered index, in the previously unused (0) PAGE_MAX_TRX_ID field, now aliased as PAGE_ROOT_AUTO_INC. Unlike some other previously unused InnoDB data fields, this one was actually always zero-initialized, at least since MySQL 3.23.49. The writes to PAGE_ROOT_AUTO_INC are protected by SX or X latch on the root page. The SX latch will allow concurrent read access to the root page. (The field PAGE_ROOT_AUTO_INC will only be read on the first-time call to ha_innobase::open() from the SQL layer. The PAGE_ROOT_AUTO_INC can only be updated when executing SQL, so read/write races are not possible.) During INSERT, the PAGE_ROOT_AUTO_INC is updated by the low-level function btr_cur_search_to_nth_level(), adding no extra page access. [Adaptive hash index lookup will be disabled during INSERT.] If some rare UPDATE modifies an AUTO_INCREMENT column, the PAGE_ROOT_AUTO_INC will be adjusted in a separate mini-transaction in ha_innobase::update_row(). When a page is reorganized, we have to preserve the PAGE_ROOT_AUTO_INC field. During ALTER TABLE, the initial AUTO_INCREMENT value will be copied from the table. ALGORITHM=COPY and online log apply in LOCK=NONE will update PAGE_ROOT_AUTO_INC in real time. innodb_col_no(): Determine the dict_table_t::cols[] element index corresponding to a Field of a non-virtual column. (The MySQL 5.7 implementation of virtual columns breaks the 1:1 relationship between Field::field_index and dict_table_t::cols[]. Virtual columns are omitted from dict_table_t::cols[]. Therefore, we must translate the field_index of AUTO_INCREMENT columns into an index of dict_table_t::cols[].) Upgrade from old data files: By default, the AUTO_INCREMENT sequence in old data files would appear to be reset, because PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC would contain the value 0 in each clustered index page. In new data files, PAGE_ROOT_AUTO_INC can only be 0 if the table is empty or does not contain any AUTO_INCREMENT column. For backward compatibility, we use the old method of SELECT MAX(auto_increment_column) for initializing the sequence. btr_read_autoinc(): Read the AUTO_INCREMENT sequence from a new-format data file. btr_read_autoinc_with_fallback(): A variant of btr_read_autoinc() that will resort to reading MAX(auto_increment_column) for data files that did not use AUTO_INCREMENT yet. It was manually tested that during the execution of innodb.autoinc_persist the compatibility logic is not activated (for new files, PAGE_ROOT_AUTO_INC is never 0 in nonempty clustered index root pages). initialize_auto_increment(): Replaces ha_innobase::innobase_initialize_autoinc(). This initializes the AUTO_INCREMENT metadata. Only called from ha_innobase::open(). ha_innobase::info_low(): Do not try to lazily initialize dict_table_t::autoinc. It must already have been initialized by ha_innobase::open() or ha_innobase::create(). Note: The adjustments to class ha_innopart were not tested, because the source code (native InnoDB partitioning) is not being compiled.
-
- 15 Dec, 2016 7 commits
-
-
Sergei Golubchik authored
in slow shutdown mode don't stop purge threads until they've purged everything there is
-
Sergei Golubchik authored
in slow shutdown mode stop all bg threads that might generate new undo records to purge before stopping purge threads.
-
Sergei Golubchik authored
in slow shutdown mode purge threads really must exit only when there is nothing to purge. Restore the trx_commit_disallowed check and don't stop purge threads until all connection thread transactions are gone.
-
Daniel Black authored
-
Daniel Black authored
-
Elena Stepanova authored
-
Elena Stepanova authored
-
- 14 Dec, 2016 3 commits
-
-
Igor Babaev authored
-
Igor Babaev authored
The patch for bug mdev-10882 tried to fix it by providing an implementation of the virtual method build_clone for the class Item_cache. It's turned out that it is not easy provide a valid implementation for Item_cache::build_clone(). At the same time if the condition that can be pushed into a materialized view contains a cached item this item can be substituted for a basic constant of the same value. In such a way we can avoid building proper clones for Item_cache objects when constructing pushdown conditions.
-
Daniel Black authored
-
- 13 Dec, 2016 3 commits
-
-
Sergei Golubchik authored
* rpm upgrade fix * update test results * valgrind warning
-
Marko Mäkelä authored
-
Alexey Botchkov authored
Now JSON functions return warnings if arguments are invalid.
-
- 12 Dec, 2016 24 commits
-
-
Sergei Golubchik authored
name innodb background threads as such
-
Sergei Golubchik authored
MDEV-11518 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_int() QUICK_RANGE_SELECT::init_ror_merged_scan() should also set and restore TABLE::vcol_set
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
Aria supports virtual columns, but does not support indexes on virtual columns. Let's issue an appropriate error in this case.
-
Sergei Golubchik authored
-
Sergei Golubchik authored
strangely enough, ?: variant does not link in some older gcc versions: sql/sql_table.cc:6409: undefined reference to `Alter_inplace_info::ALTER_STORED_GCOL_EXPR' sql/sql_table.cc:6409: undefined reference to `Alter_inplace_info::ALTER_VIRTUAL_GCOL_EXPR'
-
Sergei Golubchik authored
-
Sergei Golubchik authored
by introducing new Item::precedence() method and using it to decide whether parentheses are required
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
* do setup/cleanup for charset and arena only once per table not for every vcol * don't copy every vcol expression into table's memroot for parsing, do it in a temporary String buffer that is freed at the end * add asserts
-
Sergei Golubchik authored
now, when expr_str is gone, expr_item can be unambiguously renamed to expr.
-
Sergei Golubchik authored
otherwise we'd need to store sql_mode *per vcol* (consider CREATE INDEX...) and how SHOW CREATE TABLE would support that? Additionally, get rid of vcol::expr_str, just to make sure the string is always generated and never leaked in the original form.
-
Sergei Golubchik authored
it must, because purge opens a table that might be being altered right now
-
Sergei Golubchik authored
* remove old 5.2+ InnoDB support for virtual columns * enable corresponding parts of the innodb-5.7 sources * copy corresponding test cases from 5.7 * copy detailed Alter_inplace_info::HA_ALTER_FLAGS flags from 5.7 - and more detailed detection of changes in fill_alter_inplace_info() * more "innodb compatibility hooks" in sql_class.cc to - create/destroy/reset a THD (used by background purge threads) - find a prelocked table by name - open a table (from a background purge thread) * different from 5.7: - new service thread "thd_destructor_proxy" to make sure all THDs are destroyed at the correct point in time during the server shutdown - proper opening/closing of tables for vcol evaluations in + FK checks (use already opened prelocked tables) + purge threads (open the table, MDLock it, add it to tdc, close when not needed) - cache open tables in vc_templ - avoid unnecessary allocations, reuse table->record[0] and table->s->default_values - not needed in 5.7, because it overcalculates: + tell the server to calculate vcols for an on-going inline ADD INDEX + calculate vcols for correct error messages * update other engines (mroonga/tokudb) accordingly
-
Sergei Golubchik authored
remove 'table' argument, remnant of 5.6, does not exist in 5.7
-
Sergei Golubchik authored
* remnant of 5.6, does not exist in 5.7. bad merge? * also remove dict_table_get_col_name_for_mysql(), it was only used when index_field_t::col_name was not NULL
-
Sergei Golubchik authored
* fix "unused pending_checkpoint_mutex_key" compiler warning * clarify/simplify get_field_offset() * typos, comments * unused (forgotten) declaration of create_options_are_invalid() * fix my_error(ER_WRONG_KEY_COLUMN) calls * crash in row_upd_sec_index_entry() * double if (ret != 0) * don't duplucate PSI_INSTRUMENT_ME lines * useless break; after return(); * remove unused xtradb-only "cursor_read_view" stuff * code formatting * simplify dropped column detection * redundant assignment
-
Sergei Golubchik authored
and THD::inc_thread_count
-
Sergei Golubchik authored
-