{"id":3528,"date":"2011-04-19T06:11:14","date_gmt":"2011-04-19T04:11:14","guid":{"rendered":"http:\/\/code.openark.org\/blog\/?p=3528"},"modified":"2011-04-21T13:39:38","modified_gmt":"2011-04-21T11:39:38","slug":"impressions-from-mysql-conf-2011-part-iii-bof-replication","status":"publish","type":"post","link":"https:\/\/code.openark.org\/blog\/mysql\/impressions-from-mysql-conf-2011-part-iii-bof-replication","title":{"rendered":"Impressions from MySQL conf 2011, part III: BoF Replication"},"content":{"rendered":"<p>This post continues my impressions from some of the talks I&#8217;ve been to. I&#8217;ll dedicate this post to a single session.<\/p>\n<h4>Wednesday<\/h4>\n<ul>\n<li>BoF: Replication, Lars Thalmann<em>, <\/em>Mat Keep<em> (Oracle)<\/em><\/li>\n<\/ul>\n<p>Lars Thallman presented the MySQL 5.5 replication features, as well as the expected 5.6 features. Among other features, one could notice parallel replication, binlog checksums, sub-second resolution and more. There was an open discussion about these features, asking for comments; looking for new ideas and suggestion from the audience.<\/p>\n<p>I can&#8217;t possibly cover it all. I&#8217;ll note two discussion I participated in, and which have interested me. This also serves for noting down to myself my ideas and thoughts.<!--more--><\/p>\n<h4>Parallel replication<\/h4>\n<p>As the trend goes, parallel replication will be implemented by having a thread per schema. My own contribution to the discussion is that with such paradigm, the slave may be at any state inconsistent with the master. That is, at any point in time it can be in such state that has never existed in any point in time on the master. This is because it is possible that one or more of the replication threads executes much faster than one or more of the others.<\/p>\n<p>We have discussed the meaning of <strong>STOP SLAVE<\/strong>. I have suggested that <strong>STOP SLAVE<\/strong> works in such way that it stops in a consistent slave. Lars suggested there could be normal <strong>STOP SLAVE<\/strong> and <strong>STOP SLAVE CONSISTENT<\/strong>.<\/p>\n<p>It has been noted that we may not care about the slave being inconsistent, as the prerequisite for parallel replication is that the distinct schemata are independent of one another. After some thought, I disagree. Today parallel replication may be implemented on different schemata; tomorrow &#8211; based on finer parameters. I think it&#8217;s best to prepare for the inevitable future. Besides, <strong>STOP SLAVE INCONSISTENT<\/strong> is such an easy feature to implement!<\/p>\n<h4>Slave analysis<\/h4>\n<p>I also had a long time feature request. While writing management tools, I realized it is difficult to learn the topology of a replication environment by simple interrogation. If you connect to a master, you can either issue <strong>SHOW PROCESSLIST<\/strong> to detect the slaves, or <strong>SHOW SLAVE HOSTS<\/strong>.<\/p>\n<p>The former does not tell you the port on which the slaves are listening. The latter requires that you <a href=\"http:\/\/code.openark.org\/blog\/mysql\/the-importance-of-report_host-report_port\">configure <strong>report_host<\/strong> and <strong>report_port<\/strong> properly<\/a>.<\/p>\n<p>What I would like to see is a <strong>SHOW SLAVES STATUS<\/strong> command (or similar <strong>INFORMATION_SCHEMA<\/strong> table) <em>on the master<\/em>. Such that it lists connected slaves, one per row, with the following details:<\/p>\n<ul>\n<li><strong>Slave_host<\/strong> (this is easy, already exists in <strong>SHOW PROCESSLIST<\/strong>)<\/li>\n<li><strong>Slave_port<\/strong> (slave should send this kind of information to master upon first connect)<\/li>\n<li><strong>Slave_master_log_file<\/strong> (last log file requested by slave)<\/li>\n<li><strong>Slave_master_log_pos<\/strong> (last log pos requested by slave)<\/li>\n<li><strong>Slave_seconds_behind_master<\/strong> (slave should report this upon each request)<\/li>\n<li><strong>Slave_server_id<\/strong> (slave should send this upon connect)<\/li>\n<\/ul>\n<p>By reading <strong>Slave_host<\/strong>, <strong>Slave_port<\/strong> &amp; <strong>Slave_server_id<\/strong>, it makes it easy for us to build replication topology. It&#8217;s a single operation to detect a master&#8217;s slaves. It takes recursive steps to build entire topology.<\/p>\n<p>By reading the <strong>Slave_master_log_file<\/strong>, <strong>Slave_master_log_pos<\/strong>, we can easily determine that binary logs <em>up to that point<\/em> have already been written to the slave&#8217;s relay log. This makes it easier to decide how to purge master logs. <strong>Slave_seconds_behind_master <\/strong>completes the replication picture.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post continues my impressions from some of the talks I&#8217;ve been to. I&#8217;ll dedicate this post to a single session. Wednesday BoF: Replication, Lars Thalmann, Mat Keep (Oracle) Lars Thallman presented the MySQL 5.5 replication features, as well as the expected 5.6 features. Among other features, one could notice parallel replication, binlog checksums, sub-second [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[5],"tags":[39,8],"class_list":["post-3528","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysqlconf","tag-replication"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bZZp-UU","_links":{"self":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/comments?post=3528"}],"version-history":[{"count":20,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3528\/revisions"}],"predecessor-version":[{"id":3597,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3528\/revisions\/3597"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/media?parent=3528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/categories?post=3528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/tags?post=3528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}