Eight MySQL 8 features that will make the life of a DevOps or DBA easier.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |8 Group Replication featuresthat will make you smileTiago ValeSoftware EngineerMySQL ReplicationFebruary 1st, 2019
View Slide
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Safe Harbor StatementThe following is intended to outline our general product direction. It is intended forinformation purposes only, and may not be incorporated into any contract. It is not acommitment to deliver any material, code, or functionality, and should not be relied uponin making purchasing decisions. The development, release, timing, and pricing of anyfeatures or functionality described for Oracle’s products may change and remains at thesole discretion of Oracle Corporation.2
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Program AgendaIntroductionFeatures: ObservabilityFeatures: TroubleshootingFeatures: OperationsFeatures: Consistency123453
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Introduction4
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Database replication5INSERT ...INSERT ... INSERT ...Replication:“The process of generating and reproducingMultiple copies of data at one or more sites.”Database Systems: A Practical Approach to Design, Implementation, andManagement, Thomas M. Connolly, Carolyn E. Begg, Third Edition, 2002.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |MySQL Group Replication (GR)6Highly-available infrastructure with easeDynamically grow or shrink # of serversAutomatic consistent view of membershipSingle-primary or multi-primary modesAutomatic primary/secondary roles
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Observability: Consensus message cacheFeature #1 of 878.0.12
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consensus message cache8ServerGRGCS
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consensus message cachemysql> SELECT * FROMperformance_schema.memory_summary_global_by_event_nameWHERE event_name LIKE "GCS_XCom::xcom_cache"\G*********************** 1. row ***********************EVENT_NAME:memory/group_rpl/GCS_XCom::xcom_cacheCOUNT_ALLOC: 68659COUNT_FREE: 18660SUM_NUMBER_OF_BYTES_ALLOC: 39798266SUM_NUMBER_OF_BYTES_FREE: 10809354LOW_COUNT_USED: 0CURRENT_COUNT_USED: 49999HIGH_COUNT_USED: 50000LOW_NUMBER_OF_BYTES_USED: 0CURRENT_NUMBER_OF_BYTES_USED: 28988912HIGH_NUMBER_OF_BYTES_USED: 289895681 row in set (0,02 sec)9ServerGRGCS
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Troubleshooting: GCS trace fileFeature #2 of 8108.0.11
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |GCS trace file::set_xcom_group_information():: Configuring XCom group: XCom GroupId=60819465 Name=ff056972-2bc1-418f-8f3a-afb31c69c522::get_xcom_group_information():: Configuring XCom group: XCom GroupId=60819465 Name=NULLInitializing peers::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42012::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42022::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42032Configured total number of peers: 3Configured Local member: 127.0.0.1:42012Configured Bootstrap: trueConfigured waiting time(s): 30Gcs_xcom_engine::initialize invoked!Configured number of attempts to join: 0Configured time between attempts to join: 5Set member expel timeout to 0 seconds (0 ns).::configure_suspicions_mgr():: Set member expel timeout to 0secondswake_suspicions_processing_thread: Locked mutex!wake_suspicions_processing_thread: Signaled cond! Return= 0wake_suspicions_processing_thread: Unlocked mutex!::configure_msg_stages():: Set compression threshold to 1000000Joining a group.Started executing during regular phase: 0x7f2a8014b90011data/dir/GCS_DEBUG_TRACEServerGRGCS
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |GCS debug file::set_xcom_group_information():: Configuring XCom group: XCom GroupId=60819465 Name=ff056972-2bc1-418f-8f3a-afb31c69c522::get_xcom_group_information():: Configuring XCom group: XCom GroupId=60819465 Name=NULLInitializing peers::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42012::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42022::initialize_peer_nodes():: Configured Peer Nodes: 127.0.0.1:42032Configured total number of peers: 3Configured Local member: 127.0.0.1:42012Configured Bootstrap: trueConfigured waiting time(s): 30Gcs_xcom_engine::initialize invoked!Configured number of attempts to join: 0Configured time between attempts to join: 5Set member expel timeout to 0 seconds (0 ns).::configure_suspicions_mgr():: Set member expel timeout to 0secondswake_suspicions_processing_thread: Locked mutex!wake_suspicions_processing_thread: Signaled cond! Return= 0wake_suspicions_processing_thread: Unlocked mutex!::configure_msg_stages():: Set compression threshold to 1000000Joining a group.Started executing during regular phase: 0x7f2a8014b90012ServerGRGCSdata/dir/GCS_DEBUG_TRACEgroup_replication_communication_debug_optionsdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_communication_debug_optionsgroup_replication_communication_debug_optionsgroup_replication_communication_debug_options
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Operations: Change the primary memberFeature #3 of 8138.0.13
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the primary member14Primary SecondaryA B C
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the primary member15Primary SecondaryA B C A B CI want A to be the new primary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the primary member16Primary SecondaryA B C A B C A B CI want A to be the new primary A is the new primary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the primary member17Primary SecondaryA B C A B C A B CI want A to be the new primary A is the new primarygroup_replication_set_as_primary(member_uuid)dev.mysql.com/doc/refman/8.0/en/group-replication-changing-primary-member.html
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Operations: Change the group modeFeature #4 of 8188.0.13
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the group mode19Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the group mode20Primary SecondaryI want multi-primary mode
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the group mode21Primary SecondaryI want multi-primary mode Multi-primary it is!
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the group mode22Primary SecondaryI want multi-primary mode Multi-primary it is!group_replication_switch_to_multi_primary_mode()
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Change the group mode23Primary SecondaryI want multi-primary mode Multi-primary it is!group_replication_switch_to_multi_primary_mode()group_replication_switch_to_single_primary_mode()group_replication_switch_to_single_primary_mode(member_uuid)dev.mysql.com/doc/refman/8.0/en/group-replication-changing-group-mode.html
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Operations: Fine-tune member expulsion timeoutsFeature #5 of 8248.0.13
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts25Hmm, X seems to have failed.X is UNREACHABLE
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts26Hmm, X seems to have failed.X is UNREACHABLELet us wait for X a bitmore to give it a chance.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts27Hmm, X seems to have failed.X is UNREACHABLELet us wait for X a bitmore to give it a chance.X is back ONLINEX is back.Good thing we waited!
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts28Hmm, X seems to have failed.X is UNREACHABLELet us wait for X a bitmore to give it a chance.X is back ONLINEX is back.Good thing we waited!group_replication_member_expel_timeout = secondsdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_member_expel_timeout
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts29E.g.●X is undergoing somemaintenance task●X is physically far awayfrom others (e.g. WAN)Use case example: problemX seems to have failed.Kick it out!But I was not gone…
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Fine-tune member expulsion timeouts30Let us wait for X a bitmore to give it a chance.Use case example: solutionE.g.●X is undergoing somemaintenance task●X is physically far awayfrom others (e.g. WAN)Yay, still partof the group!
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency: Abort server when it drops out of the groupFeature #6 of 8318.0.12
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group32Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group33Leaves the group involuntarily(failed to apply changes, networkpartitioned, etc).Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group34Leaves the group involuntarily(failed to apply changes, networkpartitioned, etc).Shuts itself down, thus becomingeffectively unavailable for bothreads and writes.Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group35Leaves the group involuntarily(failed to apply changes, networkpartitioned, etc).Shuts itself down, thus becomingeffectively unavailable for bothreads and writes.Primary Secondarygroup_replication_exit_state_action = ABORT_SERVERdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_exit_state_action
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group36Use case example: problemUnaware server is out,keeps on readingstale data.Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Abort server when it drops out of the group37Use case example: solutionSees server down,fails over to another.Primary Secondary
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency: Consistency on primary fail overFeature #7 of 8388.0.14
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency on primary fail over39Primary SecondarySecondaries have a backlogof transactions to apply.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency on primary fail over40Primary SecondarySecondaries have a backlogof transactions to apply.Primary fails and groupelects new primary.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Primary fails and groupelects new primary.Consistency on primary fail over41Primary SecondarySecondaries have a backlogof transactions to apply.New primary holdsincoming operationuntil it catches up.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Primary fails and groupelects new primary.Consistency on primary fail over42Primary SecondarySecondaries have a backlogof transactions to apply.New primary holdsincoming operationuntil it catches up.Executes the heldoperation, and replies.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Primary fails and groupelects new primary.Consistency on primary fail over43Primary SecondarySecondaries have a backlogof transactions to apply.New primary holdsincoming operationuntil it catches up.Executes the heldoperation, and replies.group_replication_consistency = BEFORE_ON_PRIMARY_FAILOVERdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_consistency
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency on primary fail over44Primary SecondaryUse case example: problemWrite .Didn’t I just write !?Read from the primaryafter having written .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency on primary fail over45Primary SecondaryUse case example: solutionWrite .Yep, there’s my !Read from the primaryafter having written .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency: Consistent reads (enforced on read)Feature #8.1 of 8468.0.14
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)47Primary SecondarySecondary holdsincoming operation...
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)48Primary SecondarySecondary holdsincoming operation... ...until it applies .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)49Primary SecondarySecondary holdsincoming operation... ...until it applies .Executes the heldoperation, and replies.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)50Primary SecondarySecondary holdsincoming operation... ...until it applies .Executes the heldoperation, and replies.group_replication_consistency = BEFOREdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_consistency
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)51Primary SecondaryUse case example: problemWrite .Didn’t I just write !?Read from a secondaryafter having written .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on read)52Primary SecondaryUse case example: solutionWrite .Yep, there’s my !Read from a secondaryafter having written .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistency: Consistent reads (enforced on write)Feature #8.2 of 8538.0.14
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on write)54Primary SecondaryWrite .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on write)55Primary SecondaryWrite .Primary holds reply untilsecondaries apply .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on write)56Primary SecondaryWrite .Primary holds reply untilsecondaries apply .Replies. All subsequentoperations will see .
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads (enforced on write)57Primary SecondaryWrite .Primary holds reply untilsecondaries apply .Replies. All subsequentoperations will see .group_replication_consistency = AFTERdev.mysql.com/doc/refman/8.0/en/group-replication-options.html#sysvar_group_replication_consistency
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads trade offs• BEFORE puts burden on readers• Better when #writes > #reads• E.g.– Ensure that critical transactionobserves fresh data on asecondary– Take an fresh snapshot from asecondary• AFTER puts burden on writers• Better when #reads > #writes• E.g.– Infrequent write pays forfrequent reads to see freshdata– Load balance reads to freshdata58
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Consistent reads trade offs• BEFORE puts burden on readers• Better when #writes > #reads• E.g.– Ensure that critical transactionobserves fresh data on asecondary– Take an fresh snapshot from asecondary• AFTER puts burden on writers• Better when #reads > #writes• E.g.– Infrequent write pays forfrequent reads to see freshdata– Load balance reads to freshdata59We also have BEFORE_AND_AFTER
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 60Conclusion• MySQL GR: high availability and ease of use• New features:– Observe into GCS– Troubleshoot GCS– Change group configuration online– Fine-tune member expulsions– Freshness guarantees for readsServerGRGCS
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 61Where to go from here?• Packages– mysql.com/downloads• Documentation– dev.mysql.com/doc/refman/8.0/en• Blogs from engineers (news, technical information, and more)– mysqlhighavailability.com
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Thank you for your time62
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Safe Harbor StatementThe preceding is intended to outline our general product direction. It is intended forinformation purposes only, and may not be incorporated into any contract. It is not acommitment to deliver any material, code, or functionality, and should not be relied uponin making purchasing decisions. The development, release, timing, and pricing of anyfeatures or functionality described for Oracle’s products may change and remains at thesole discretion of Oracle Corporation.63