summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Removed even more warning that was found with -WunusedMonty2018-04-3015-50/+28
| | | | | | - Removed test if HA_FT_WTYPE == HA_KEYTYPE_FLOAT as this never worked (HA_KEYTYPE_FLOAT is an enum) - Define HA_FT_MAXLEN to 126 (was tested before but never defined)
* Added version of lex_string_eq that compares with const char *Monty2018-04-307-25/+31
| | | | | | | | Change all my_stcasecmp() calls that uses lexical keywords to use lex_string_eq. This is faster as we only call strcasecmp() for strings of different lengths. Removed not used function lex_string_syseq()
* Added more test to sql-benchMonty2018-04-303-2/+48
| | | | | | | - test-alter now correctly drops all columns - test-alter has a new test that times adding columns in middle of table - test-insert has a new test to check updates that doesn't change data - test-insert: update_with_key_prefix didn't change data. Now fixed
* MDEV-14906 Assertion index->is_instant() failed on DELETEMarko Mäkelä2018-04-301-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion would fail with the following trace: rec_init_offsets_comp_ordinary(..., format=REC_LEAF_COLUMNS_ADDED) rec_init_offsets() rec_get_offsets_func() rec_copy_prefix_to_dtuple() dict_index_build_data_tuple() btr_pcur_restore_position_func() When btr_cur_store_position() had stored pcur->old_rec, the table contained instantly added columns. The table was emptied (dict_index_t::remove_instant() invoked) between the 'store' and 'restore' operations, causing the assertion to fail. Here is a non-deterministic test case to repeat the scenario: --source include/have_innodb.inc --connect (con1,localhost,root,,test) CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE = InnoDB; INSERT INTO t1 VALUES (0); ALTER TABLE t1 ADD COLUMN a INT; ALTER TABLE t1 ADD UNIQUE KEY (a); DELETE FROM t1; send INSERT INTO t1 VALUES (1,0),(2,0); --connection default DELETE FROM t1; # the assertion could fail here DROP TABLE t1; --disconnect con1 The fix is to normalize the pcur->old_rec so that when the record prefix is stored, it will always be in the plain format. This can be done, because the record prefix never includes any instantly added columns. (It can only include key columns, which can never be instantly added.) rec_copy_prefix_to_buf(): Convert REC_STATUS_COLUMNS_ADDED to REC_STATUS_ORDINARY format.
* MDEV-16058 Unnecessary computations for SPATIAL INDEXMarko Mäkelä2018-04-303-43/+38
| | | | | | | | | dict_index_copy_rec_order_prefix(): Avoid invoking dict_index_get_n_unique_in_tree_nonleaf(). create_index(): Simplify code for creating SPATIAL or FULLTEXT index. rec_copy_prefix_to_buf(): Skip the loop for SPATIAL INDEX.
* Simplify dict_stats_analyze_index_level()Marko Mäkelä2018-04-301-5/+4
| | | | | | Only allocate n_uniq elements for offsets, instead of index->n_fields. (Statistics are never computed on spatial indexes, so we never need to access more fields even in rec_copy_prefix_to_buf().)
* rtr_estimate_n_rows_in_range(): Simplify codeMarko Mäkelä2018-04-301-40/+25
|
* Add an explicit cast from double to ha_rowsMarko Mäkelä2018-04-301-3/+3
|
* Fix some -Wsign-conversionMarko Mäkelä2018-04-2913-69/+65
| | | | InnoDB was using int64_t instead of ha_rows (unsigned 64-bit).
* MDEV-16045: Replace log_group_t with log_t::filesMarko Mäkelä2018-04-298-481/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is only one log_sys and only one log_sys.log. log_t::files::create(): Replaces log_init(). log_t::files::close(): Replaces log_group_close(), log_group_close_all(). fil_close_log_files(): if (free) log_sys.log_close(); The callers that passed free=true used to call log_group_close_all(). log_header_read(): Replaces log_group_header_read(). log_t::files::file_header_bufs_ptr: Use a single allocation. log_t::files::file_header_bufs[]: Statically allocate the pointers. log_t::files::set_fields(): Replaces log_group_set_fields(). log_t::files::calc_lsn_offset(): Replaces log_group_calc_lsn_offset(). Simplify the computation by using fewer variables. log_t::files::read_log_seg(): Replaces log_group_read_log_seg(). log_sys_t::complete_checkpoint(): Replaces log_io_complete_checkpoint(). fil_aio_wait(): Move the logic from log_io_complete().
* MDEV-16045: Allocate log_sys staticallyMarko Mäkelä2018-04-2919-477/+472
| | | | | | | | | | | | There is only one redo log subsystem in InnoDB. Allocate the object statically, to avoid unnecessary dereferencing of the pointer. log_t::create(): Renamed from log_sys_init(). log_t::close(): Renamed from log_shutdown(). log_t::checkpoint_buf_ptr: Remove. Allocate log_t::checkpoint_buf statically.
* MDEV-12218 Clean up InnoDB parameter validationMarko Mäkelä2018-04-2946-922/+622
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bind more InnoDB parameters directly to MYSQL_SYSVAR and remove "shadow variables". innodb_change_buffering: Declare as ENUM, not STRING. innodb_flush_method: Declare as ENUM, not STRING. innodb_log_buffer_size: Bind directly to srv_log_buffer_size, without rounding it to a multiple of innodb_page_size. LOG_BUFFER_SIZE: Remove. SysTablespace::normalize_size(): Renamed from normalize(). innodb_init_params(): A new function to initialize and validate InnoDB startup parameters. innodb_init(): Renamed from innobase_init(). Invoke innodb_init_params() before actually trying to start up InnoDB. srv_start(bool): Renamed from innobase_start_or_create_for_mysql(). Added the input parameter create_new_db. SRV_ALL_O_DIRECT_FSYNC: Define only for _WIN32. xb_normalize_init_values(): Merge to innodb_init_param().
* Do not divide or multiply by srv_page_sizeMarko Mäkelä2018-04-2832-157/+164
| | | | Instead, shift by srv_page_size_shift.
* Replace univ_page_size and UNIV_PAGE_SIZEMarko Mäkelä2018-04-2884-546/+541
| | | | | | Try to use one variable (srv_page_size) for innodb_page_size. Also, replace UNIV_PAGE_SIZE_SHIFT with srv_page_size_shift.
* Fix most -Wsign-conversion in InnoDBMarko Mäkelä2018-04-28103-735/+662
| | | | Change innodb_buffer_pool_size, innodb_fill_factor to unsigned.
* Fix some -Wsign-conversionMarko Mäkelä2018-04-281-5/+6
|
* Simplify simple_counterMarko Mäkelä2018-04-282-35/+28
| | | | Introduce a separate simple_atomic_counter
* Correct member function commentsMarko Mäkelä2018-04-281-2/+2
|
* Merge 10.2 into 10.3Marko Mäkelä2018-04-281-128/+117
|\
| * Revert "Fix mtr to be able to wait for >1 exited mysqld"Marko Mäkelä2018-04-281-128/+117
| | | | | | | | | | | | | | | | | | This reverts commit 72deed59880bd2a92e3210648de72d9e2e4d9afd which was merged as commit 29d4ac2ceb0cc4545cc4d04368edb470c4f3a7aa. The change caused regressions, such as mysql-test-run failing to run at all with --valgrind, or aborting on Windows on the first test failure.
* | MDEV-11084 Select statement with partition selection against MyISAMAlexey Botchkov2018-04-281-8/+15
| | | | | | | | | | | | table opens all partitions. Not-used partitions are not closed now.
* | Cleanup for MDEV-16020 (fixing compilation failure on Windows)Alexander Barkov2018-04-281-1/+1
| |
* | MDEV-16020 SP variables inside GROUP BY..WITH ROLLUP break replicationAlexander Barkov2018-04-2713-2390/+2857
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code passing positions in the query to constructors of Rewritable_query_parameter descendants (e.g. Item_splocal) was not reliable. It used various Lex_input_stream methods: - get_tok_start() - get_tok_start_prev() - get_tok_end() - get_ptr() to find positions of the recently scanned tokens. The challenge was mostly to choose between get_tok_start() and get_tok_start_prev(), taking into account to the current grammar (depending if lookahead takes place before or after we read the positions in every particular rule). But this approach did not work at all in combination with token contractions, when MYSQLlex() translates two tokens into one token ID, for example: WITH ROLLUP -> WITH_ROLLUP_SYM As a result, the tokenizer is already one more token ahead. So in query fragment: "GROUP BY d, spvar WITH ROLLUP" get_tok_start() points to "ROLLUP". get_tok_start_prev() points to "WITH". As a result, it was "WITH" who was erroneously replaced to NAME_CONST() instead of "spvar". This patch modifies the code to do it a different way. Changes: 1. For keywords and identifiers, the tokenizer now returns LEX_CTRING pointing directly to the query fragment. So query positions are now just available using: - $1.str - for the beginning of a token - $1.str+$1.length - for the end of a token 2. Identifiers are not allocated on the THD memory root in the tokenizer any more. Allocation is now done on later stages, in methods like LEX::create_item_ident(). 3. Two LEX_CSTRING based structures were added: - Lex_ident_cli_st - used to store the "client side" identifier representation, pointing to the query fragment. Note, these identifiers are encoded in @@character_set_client and can have broken byte sequences. - Lex_ident_sys_st - used to store the "server side" identifier representation, pointing to the THD allocated memory. This representation guarantees that the identifier was checked for being well-formed, and is encoded in utf8. 4. To distinguish between two identifier types in the grammar, two Bison types were added: <ident_cli> and <ident_sys> 5. All non-reserved keywords were marked as being of the type <ident_cli>. All reserved keywords are still of the type NONE. 6. All curly brackets in rules collecting non-reserved keywords into non-terminal symbols were removed, e.g.: Was: keyword_sp_data_type: BIT_SYM {} | BOOLEAN_SYM {} Now: keyword_sp_data_type: BIT_SYM | BOOLEAN_SYM This is important NOT to have brackets here!!!! This is needed to make sure that the underlying Lex_ident_cli_ststructure correctly passes up to the calling rule. 6. The code to scan identifiers and keywords was moved from lex_one_token() into new Lex_input_stream methods: scan_ident_sysvar() scan_ident_start() scan_ident_middle() scan_ident_delimited() This was done to: - get rid of enormous amount of references to &yylval->lex_str - and remove a lot of references like lip->xxx 7. The allocating functionality which puts identifiers on the THD memory root now resides in methods of Lex_ident_sys_st, and in THD::to_ident_sys_alloc(). get_quoted_token() was removed. 8. Cleanup: check_simple_select() was moved as a method to LEX. 9. Cleanup: Some more functionality was moved from *.yy to new methods were added to LEX: make_item_colon_ident_ident() make_item_func_call_generic() create_item_qualified_asterisk()
* | MDEV-16038 Assertion `map->n_bits > 0' failed (my_bitmap.c:386: ↵Igor Babaev2018-04-264-2/+22
| | | | | | | | | | | | | | bitmap_is_clear_all) Rows with no elements are not allowed in a table value constructor unless it is used in an INSERT statement.
* | Merge 10.2 into 10.3Marko Mäkelä2018-04-268-70/+33
|\ \ | |/
| * Follow-up fix to MDEV-14705: Flush log at shutdownMarko Mäkelä2018-04-261-0/+3
| | | | | | | | | | | | | | | | In the merge of commit e7f4e61f6e013e8879a64dae3ab0370ec137a121 the call fil_flush_file_spaces(FIL_TYPE_LOG) is necessary. Tablespaces will be flushed as part of the redo log checkpoint, but the redo log will not necessarily be flushed, depending on innodb_flush_method.
| * MDEV-16041 Do not write for null update (properly fix MySQL Bug#29157)Marko Mäkelä2018-04-264-15/+22
| | | | | | | | | | | | | | | | | | | | | | InnoDB takes a lot of time to perform null updates. The reason is that even though an empty update vector was created, InnoDB will go on to write undo log records and update the system columns DB_TRX_ID and DB_ROLL_PTR in the clustered index, and of course write redo log for all this. This could have been fixed properly in commit 54a492ecac792a13f374978ba0584d3e7eb9ab77 more than 10 years ago.
| * innobase_init(): Remove some dead codeMarko Mäkelä2018-04-261-24/+1
| | | | | | | | | | | | | | | | | | | | | | Remove the local variable srv_buf_pool_size_org, which was always 0. In MySQL 5.7, InnoDB was made a mandatory storage engine, which would force InnoDB to start up when executing mysqld --verbose --help which is what mysql-test-run.pl is doing as a first step. With a large innodb_buffer_pool_size, this would take a long time. So, MySQL 5.7 includes a hack that starts up InnoDB with a smaller buffer pool when the option --verbose is present.
| * Remove dead code HAVE_LZO1XMarko Mäkelä2018-04-261-15/+0
| | | | | | | | | | | | MariaDB uses HAVE_LZO, not HAVE_LZO1X (which was never defined). Also, the variable srv_lzo_disabled was never defined or read (only declared and assigned to, in unreachable code).
| * MDEV-15507 Assertion failed in dict_check_sys_tables on upgrade from 5.5Marko Mäkelä2018-04-262-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InnoDB system table column SYS_TABLES.MIX_LEN was repurposed in InnoDB Plugin for MySQL 5.1, in commit 91111174ee920d797494403cfc88df34fddda4b5 (MySQL 5.1.46). Until MySQL 5.6, it only contained a flag DICT_TF2_TEMPORARY. MySQL 5.6 introduced a number of flags that were transient in nature. One of these was introduced in 5.6.5, originally called DICT_TF2_USE_TABLESPACE and later renamed to DICT_TF2_USE_FILE_PER_TABLE. MySQL 5.7.6 introduced logic that insists that the flag be set for any table that does not reside in a shared tablespace, breaking upgrade from MySQL 5.5. MariaDB does not support shared tablespaces other than the InnoDB system tablespace. Also, some dependencies on SYS_TABLES.MIX_LEN were removed in an earlier fix: MDEV-13084 MariaDB 10.2 crashes on corrupted SYS_TABLES.MIX_LEN field (commit e813fe862226554cfe31754b3dfeafbb2b9a7159). dict_check_sys_tables(): Remove a bogus debug assertion, and add a comment that explains how DICT_TF2_USE_FILE_PER_TABLE is used. dict_table_is_file_per_table(): Remove a bogus debug assertion.
* | MDEV-15914: Make mtr_buf_t a plain classMarko Mäkelä2018-04-261-38/+23
| |
* | MDEV-15914: Simplify mlog_open_and_write_index()Marko Mäkelä2018-04-261-35/+25
| |
* | MDEV-15914: Use buf_block_t* for undo, not page_t*Marko Mäkelä2018-04-261-128/+105
| | | | | | | | | | | | trx_undof_page_add_undo_rec_log(): Write the undo page number directly from the buf_block_t descriptor, not by decoding the fields in the page frame.
* | MDEV-15914: Restore MLOG_UNDO_INSERTMarko Mäkelä2018-04-263-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trx_undof_page_add_undo_rec_log(): Write the MLOG_UNDO_INSERT record instead of the equivalent MLOG_2BYTES and MLOG_WRITE_STRING. This essentially reverts commit 9ee8917dfd4b6c9d342cbc030ca71bad637fa24a. In MariaDB 10.3, I attempted to simplify the crash recovery code by making use of lower-level redo log records. It turns out that we must keep the redo log parsing code in order to allow crash-upgrade from older MariaDB versions (MDEV-14848). Now, it further turns out that the InnoDB redo log record format is suboptimal for logging multiple changes to a single page. This simple change to the redo logging of undo log significantly affects the INSERT and UPDATE performance. Essentially, we wrote (space_id,page_number,MLOG_2BYTES,2 bytes) (space_id,page_number,MLOG_WRITE_STRING,N+4 bytes) instead of the previously written (space_id,page_number,MLOG_UNDO_INSERT,N+2 bytes) The added redo log volume caused a single-threaded INSERT (without innodb_adaptive_hash_index) of 1,000,000 rows to consume 11 seconds instead of 9 seconds, and a subsequent UPDATE of 30,000,000 rows to consume 64 seconds instead of 58 seconds. If we omitted all redo logging for the undo log, the INSERT would consume only 4 seconds.
* | MDEV-15914: Remove trx_t::undo_mutexMarko Mäkelä2018-04-2615-74/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The trx_t::undo_mutex covered both some main-memory data structures (trx_undo_t) and access to undo pages. The trx_undo_t is only accessed by the thread that is associated with a running transaction. Likewise, each transaction has its private set of undo pages. The thread that is associated with an active transaction may lock multiple undo pages concurrently, but no other thread may lock multiple pages of a foreign transaction. Concurrent access to the undo logs of an active transaction is possible, but trx_undo_get_undo_rec_low() only locks one undo page at a time, without ever holding any undo_mutex. It seems that the trx_t::undo_mutex would have been necessary if multi-threaded execution or rollback of a single transaction had been implemented in InnoDB.
* | MDEV-12288/MDEV-15132/MDEV-15158: Adjust a commentMarko Mäkelä2018-04-261-8/+11
| |
* | MDEV-15914: Remove trx_undo_t::emptyMarko Mäkelä2018-04-265-32/+33
| | | | | | | | | | Use the value trx_undo_t::top_undo_no == IB_ID_MAX for indicating that an undo log is empty.
* | MDEV-15914: buf_pool_is_obsolete(): Add UNIV_UNLIKELYMarko Mäkelä2018-04-261-3/+3
| |
* | MDEV-15914: Simplify row_search_mvcc()Marko Mäkelä2018-04-261-35/+22
| |
* | MDEV-15914: Fast path for rw_trx_hash::find()Marko Mäkelä2018-04-261-0/+6
| | | | | | | | | | | | rw_trx_hash_t::find(): Implement a fast path for looking up the current transaction. This helps transactions that visit rows modified by themselves.
* | MDEV-15915 Add Feature_json status variable.Alexey Botchkov2018-04-266-0/+48
| | | | | | | | Related implementations.
* | Removed some old #if MYSQL_VERSIONMonty2018-04-264-34/+0
| | | | | | | | | | - Removed never used warning that explicit_defaults_for_timestamp was not set
* | Fix a lot of compiler warnings found by -WunusedMonty2018-04-2634-68/+60
| |
* | MDEV-15732: Assertion `next_free_value % real_increment == offset && ↵Oleksandr Byelkin2018-04-263-2/+33
| | | | | | | | | | | | | | 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()
* | tests: func_math, correct crc32 for mariadbDaniel Black2018-04-262-12/+8
| | | | | | | | | | | | | | | | | | | | | | Differences: MariaDB doesn't support a JSON type therefore the crc32 on those values are different. JSON extract syntax is different. loaddata_utf8 has 3 duplicate lines removed compared to MySQL version.
* | BUG#26495791: CONTRIBUTION: EXPAND TEST SUITE TO INCLUDE CRC32 TESTSShivashankar Nagaraj2018-04-262-0/+627
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From mysql-server: 09fdfad50764ff6809e7dd5300e9ce1ab727b62a e90ae1707e0ca46abc775d1680d1856c4be38b66 described in http://github.com/mysql/mysql-server/pull/157 Apart from external contribution I have added few more additional testcases for CRC32() function, which are given below. New Testcases added: ->Verify the crc value of various numeric and string data types(int, double, blob, text, json, enum, set) ->Verify the crc value when expressions having comparison_operators and logical_operators ->Verify the crc value for the expression having string_functions, arithmetic_functions, json_functions ->Verify the crc value for the expression having Geometry functions like POINT, LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON ->Verify the crc value generated from stored procedures, functions, triggers, prepare statement, views. Fix: Patch based on contribution by Daniel Black (Github user: grooverdan) Reviewed-by: Anitha Gopi anitha.gopi@oracle.com Reviewed-by: Srikanth B R srikanth.b.r@oracle.com RB: 17294
* | Fixed a compiler errorIgor Babaev2018-04-251-1/+2
| |
* | MDEV-11975: SQLCOM_PREPARE of EXPLAIN & ANALYZE statement do not return ↵Oleksandr Byelkin2018-04-256-10/+497
| | | | | | | | | | | | correct metadata info Added metadate info after prepare EXPLAIN/ANALYZE.
* | MDEV-13695: INTERSECT precedence is not in line with Oracle even in ↵Oleksandr Byelkin2018-04-253-1/+100
| | | | | | | | | | | | SQL_MODE=Oracle Switch off automatic INTERSECT priority for ORACLE MODE
* | MDEV-15079: Parameter array operation inserts wrong values in autoincrement ↵Oleksandr Byelkin2018-04-251-0/+54
| | | | | | | | | | | | field if indicator was specified test added (bug is fixed)