What's new in MySQL 5 - PerconaWhat's new in MySQL 5.7 Marcos Albe Percona University Montevideo,...
Transcript of What's new in MySQL 5 - PerconaWhat's new in MySQL 5.7 Marcos Albe Percona University Montevideo,...
What's new in MySQL 5.7
Marcos AlbePercona University
Montevideo, April 2014
www.percona.com
Agenda
● InnoDB
● Replication
● PERFORMANCE_SCHEMA
● Operational
● Command line client (mysql)
● Security
● Miscellaneous
www.percona.com
Foreword
● 5.7 work in progress... so doublecheck!
● Not trying to be exhaustive... read manual!
● Good job Oracle! (hope to see tests code free soon)
www.percona.com
InnoDB improvements
● Multiple page_cleaner threads for [dirty] buffer pool flushing – Set with innodb_page_cleaners = N
● Enhanced buffer pool dump and load operations – Set with innodb_buffer_pool_dump_pct
– Throttled by innodb_io_capacity
● Supports rebuilding regular and partitioned tables using ALGORITHM=INPLACE with: OPTIMIZE TABLE ALTER TABLE ... FORCE ALTER TABLE ... ENGINE=INNODB
www.percona.com
InnoDB improvements II
● Doublewrite disabled devices with atomic writes. – Been here, done that:
http://www.percona.com/doc/percona-server/5.5/performance/atomic_fio.html ;-)
– Awesome stuff that increases value and lifetime of very expensive hardware.
● InnoDB Monitor uses vars instead of tables– innodb_monitor => innodb_status_output
– innodb_lock_monitor => innodb_status_output_locks
● Reworked GIS (spatial data types) for InnoDB
www.percona.com
InnoDB improvements III
● Improved DDL performance for InnoDB temporary tables
● New ibtmp1 for non-compressed temporary tables– innodb_temp_data_file_path
– Keeps new type of non-redo undo log for temporary tables
● Temporary table metadata is no longer stored to InnoDB system tables– now in I_S.INNODB_TEMP_TABLE_INFO
www.percona.com
InnoDB improvements IV
● Enhanced innochecksum – Supports files > 2GB
– Can rewrite [invalid] checksums with --write
– Tablespace stats: --page-type-summary (woohoo!) ================PAGE TYPE SUMMARY============== #PAGE_COUNT PAGE_TYPE =============================================== 2 Index page 0 Undo log page 1 Inode page 0 Insert buffer free list page 2 Freshly allocated page 1 Insert buffer bitmap 0 System page 0 Transaction system page 1 File Space Header 0 Extent descriptor page 0 BLOB page 0 Compressed BLOB page 0 Other type of page
www.percona.com
Replication improvements I
● Different method for parallel replication (slave-parallel-type)– DATABASE: thread-per-schema
– LOGICAL_CLOCK: time hints ● Timestamp information stored by the master● Tells slaves when it is safe to run threads in parallel:
"The timestamp identifies the last transaction committed at the time that the current transaction entered the prepare stage, and all transactions having the same timestamp can execute in parallel"
www.percona.com
Replication improvements II
● Refactored master's dump thread– Reduce lock contention/improve throughput
– Multiple dump threads are now able to read concurrently
– Dump threads are now able to read while clients are writing
● More flexibility with Semi-synchronous replication– rpl_semi_sync_master_wait_for_slave_count (was fixed to 1
before)
– rpl_semi_sync_master_wait_point (AFTER_SYNC / AFTER_COMMIT)
– Separate threads for sending/receiving semisynchronous replication acknowledgement signals
www.percona.com
Replication improvements III
● Database name rewriting with mysqlbinlog – ROW based replication only
– --rewrite-db='dboldname->dbnewname'
– Can be specified multiple times
● CHANGE REPLICATION FILTER statement
– Allows to dynamically set replication filtering rules
– STOP SLAVE SQL_THREAD before changing
– START SLAVE SQL_THREAD after changing
www.percona.com
Replication improvements IV
● Can CHANGE MASTER TO without [full] STOP SLAVE– If SQL thread stopped: can change RELAY_LOG_FILE,
RELAY_LOG_POS, and MASTER_DELAY
– If IO thread stopped: can change any options except above ones
– Both threads stopped: MASTER_AUTO_POSITION=1
● Non-blocking SHOW SLAVE STATUS\G
● A warning is emitted after STOP SLAVE+CHANGE MASTER when Slave_open_temp_tables > 0 (SBR)
www.percona.com
'mysql' client improvements
● Ctrl-C works as expected now!!– Aborts query or input line
– Does NOT quit client
● The "mysql" client now has a --syslog option that sends interactive statements to system's syslog – Suppressed for statements matching default "ignore" pattern
("*IDENTIFIED*:*PASSWORD*")
– Suppressed for any patterns specified using the --histignore
● Now the --ssl option enfornces SSL (previously it was advisory)
www.percona.com
Custom full-text parsing
● Full-text parser plugins;
● Two possible roles:– Replace parser (i.e. how text is converted to words)
– Translate for parser (from PDF, DOC, XML, etc.)
– Can do both roles
● Plugin per-index:
CREATE TABLE t ( doc CHAR(255), FULLTEXT INDEX (doc) WITH PARSER my_parser) ENGINE=InnoDB;
www.percona.com
Miscellaneous improvements I
● EXPLAIN FOR CONNECTION <connection id>
● EXPLAIN includes “cost information” (use JSON format)
● EXPLAIN PARTITIONS/EXTENDED always enabled
● Ability to set timeout for SELECTs– Per statement: SELECT MAX_STATEMENT_TIME = 5000 id,
name FROM my_table...
– Global/session: max_statement_time
● Multiple triggers per event/time– added trigger_order to triggers syntax
www.percona.com
Miscellaneous improvements II
● Strict sql_mode (STRICT_ALL_TABLES|STRICT_TRANS_TABLES) now implies– ERROR_FOR_DIVISION_BY_ZERO
– NO_ZERO_DATE
– NO_ZERO_IN_DATE
● Less verbose bootstrap (a.k.a. mysql_install_db)\– Avoid missing important messages
● MTR uses InnoDB as default storage engine.– Better testing for InnoDB in general
– More code coverage
www.percona.com
PERFORMANCE_SCHEMA I
● Memory usage instrumentation!!! – Helps to understand/tune the memory consumption
– Helps find memory leaks
– New P_S tables● memory_summary_global_by_event_name ● memory_summary_by_account_by_event_name ● memory_summary_by_host_by_event_name ● memory_summary_by_thread_by_event_name ● memory_summary_by_user_by_event_name
www.percona.com
PERFORMANCE_SCHEMA II
● Transactions instrumentation!!!
– Transaction latency
– Isolation levels
– Auto-commit
– Rollback savepoints info
– GTID/Transaction IDs
– Link transactions to statements!.
www.percona.com
PERFORMANCE_SCHEMA III
● New P_S tables for transactions instrumentationb– events_transactions_current
– events_transactions_history
– events_transactions_history_long
– events_transactions_summary_by_account_by_event_name
– events_transactions_summary_by_host_by_event_name
– events_transactions_summary_by_thread_by_event_name
– events_transactions_summary_by_user_by_event_name
– events_transactions_summary_global_by_event_name
www.percona.com
PERFORMANCE_SCHEMA IV
● Replication configuration and status exposed in tables
– Superset for SHOW SLAVE STATUS
– Good for monitoring and failover trickery...but still lacks master status!! (as noted by Giusseppe)
● New P_S tables– replication_connection_configuration
– replication_connection_status
– replication_execute_configuration
– replication_execute_status
– replication_execute_status_by_coordinator
– replication_execute_status_by_worker
www.percona.com
Security changes I
● Impacts 5.1/5.5/5.6 to 5.7 upgrades– Rows in mysql.user must have nonempty plugin column
– Default_authentication_plugin
● Ability to set policy for automatic password expiration– Default_password_lifetime
– Disconnect_on_expired_password
www.percona.com
Security changes II
● Secured installation by default– Can disable with --skip-random-passwords
● Single root account 'root'@'localhost'– Random expired password for this account.
– Random password saved in $HOME/.mysql_secret
● No anonymous-user accounts.
● No “test” database.
www.percona.com
Partitioning improvements
● Improved Transportable Tablespace feature – Supports partitioned tables
– Supports individual table partitions.
● Index condition pushdown support for partitioned tables (InnoDB/MyISAM)
www.percona.com
Operational improvements
● Online ALTER TABLE for RENAME INDEX
– Change is made in place
– no table-copy operation
– Works for all storage engines
● VARCHAR size may be increased with ALTER TABLE ... ALGORITHM=INPLACE [InnoDB only]
www.percona.com
Questions
?
We're Hiring! www.percona.com/about-us/careers/