{"id":3124,"date":"2010-12-15T08:31:24","date_gmt":"2010-12-15T06:31:24","guid":{"rendered":"http:\/\/code.openark.org\/blog\/?p=3124"},"modified":"2010-12-15T13:02:08","modified_gmt":"2010-12-15T11:02:08","slug":"openark-kit-rev-170-new-tools-new-functionality","status":"publish","type":"post","link":"https:\/\/code.openark.org\/blog\/mysql\/openark-kit-rev-170-new-tools-new-functionality","title":{"rendered":"openark-kit (rev. 170): new tools, new functionality"},"content":{"rendered":"<p>I&#8217;m pleased to announce a new release of the <a href=\"http:\/\/code.openark.org\/forge\/openark-kit\">openark kit<\/a>. There&#8217;s a lot of new functionality inside; following is a brief overview.<\/p>\n<p>The <em>openark kit<\/em> is a set of utilities for MySQL. They  solve everyday maintenance tasks, which may be complicated or time  consuming to work by hand.<\/p>\n<p>It&#8217;s been a while since the last announced release. Most of my attention was on <a href=\"http:\/\/code.openark.org\/forge\/mycheckpoint\">mycheckpoint<\/a>, building new features, writing documentation etc. However my own use of <em>openark kit<\/em> has only increased in the past few months, and there&#8217;s new useful solutions to common problems that have been developed.<\/p>\n<p>I&#8217;ve used and improved many tools over this time, but doing the final cut, along with proper documentation, took some time. Anyway, here are the highlights:<\/p>\n<h4>New tool: oak-hook-general-log<\/h4>\n<p><em>oak-hook-general-log<\/em> hooks up a MySQL server and dumps the general log based on filtering rules, applying to query role or execution plan. It is possible to only dump connect\/disconnect entries, queries which make a full table scan, or use temporary tables, or scan more than X number of rows, or&#8230;<\/p>\n<p>I&#8217;ll write more on this tool shortly.<\/p>\n<h4>New tool: oak-prepare-shutdown<\/h4>\n<p>This tool makes for an orderly and faster shutdown by safely stopping replication, and flushing InnoDB pages to disk prior to shutting down (keeping server available for connections even while attempting to flush dirty pages to disk). A typical use case would be:<\/p>\n<blockquote>\n<pre>oak-prepare-shutdown --user=root --ask-pass --socket=\/tmp\/mysql.sock &amp;&amp; \/etc\/init.d\/mysql stop<\/pre>\n<\/blockquote>\n<h4>New tool: oak-repeat query<\/h4>\n<p><em>oak-repeat-query<\/em> repeats executing a given query until some condition holds. The condition can be:<\/p>\n<ul>\n<li>Number of given iterations has been reached<\/li>\n<li>Given time has elapsed<\/li>\n<li>No rows have been affected by query<\/li>\n<\/ul>\n<p>The tool comes in handy for cleanup jobs, warming up caches, etc.<!--more--><\/p>\n<h4>New tool: oak-get-slave-lag<\/h4>\n<p>This simple tool just returns the number of seconds a slave is behind master. But it also returns with an appropriate exit code, based on a given threshold: <strong>0<\/strong> when lag is good, <strong>1<\/strong> (error exit code) when lag is too great or slave fails to replicate.<\/p>\n<p>This tool has been used by 3rd party applications, such as a load balancer, to determine whether a slave should be accessed.<\/p>\n<h4>Updated tool: oak-chunk-update<\/h4>\n<p>This extremely useful utility breaks down very long queries into smaller chunks. These could be queries which should affect a huge amount of rows, or queries which cannot utilize an index.<\/p>\n<p>Updates to the tool include limiting the range of rows the tool scans, by specifying start and stop position (either by providing constant values or by SELECT query). Also added is auto-termination when no rows are found to be affected. Last, it is possible to override INFORMATION_SCHEMA lookup by explicitly specifying chunking key.<\/p>\n<p>This tool works great for your daily\/weekly\/monthly batch jobs; in creating DWH tables; populating new columns; purging old entries; clearing data based on non-indexed values; generating summary tables; and more.<\/p>\n<h4>Frozen tool: oak-apply-ri<\/h4>\n<p>I haven&#8217;t been using this tool for a while. The main work down by this tool can be done with <em>oak-chunk-update<\/em>. There are some additional safety checks <em>oak-apply-ri<\/em> provides; I&#8217;m thinking over if they justify the tool&#8217;s existence.<\/p>\n<h4>Frozen tool: oak-online-alter-table<\/h4>\n<p>With the appearance of Facebook\u2019s <a href=\"http:\/\/www.facebook.com\/note.php?note_id=430801045932\">Online Schema Change<\/a> (OSC) tool, which derives from <em>oak-online-alter-table<\/em>, I&#8217;m not sure I will continue developing the tool. I intend to wait for general feedback on OSC before making a decision.<\/p>\n<h4>Documentation<\/h4>\n<p><a href=\"http:\/\/openarkkit.googlecode.com\/svn\/trunk\/openarkkit\/doc\/html\/introduction.html\">Documentation<\/a> is now part of <em>openark kit<\/em>&#8216;s SVN repository.<\/p>\n<h4>Download<\/h4>\n<p>The <em>openark kit<\/em> project is currently hosted by Google Code.  Downloads are available at the Google Code <a href=\"http:\/\/code.google.com\/p\/openarkkit\/\">openark kit project page<\/a>.<\/p>\n<p>Downloads are available in the following packaging formats:<\/p>\n<ul>\n<li><strong>.deb<\/strong> package, to be installed on <em>debian<\/em>, <em>ubuntu<\/em> and otherwise debian based distributions.<\/li>\n<li><strong>.rpm<\/strong> package, architecture free (<em>noarch<\/em>), for RPM supporting Linux distributions such as <em>RedHat<\/em>, <em>Fedora<\/em>, <em>CentOS<\/em> etc.<\/li>\n<li><strong>.tar.gz<\/strong> using python&#8217;s distutils installer.<\/li>\n<li><strong>source<\/strong>, directly retrieved from SVN or from above python package.<\/li>\n<li>Some distribution specific <a href=\"http:\/\/software.opensuse.org\/search?baseproject=ALL&amp;p=1&amp;q=openark-kit\">RPM packages<\/a>, courtesy Lenz Grimmer.<\/li>\n<\/ul>\n<h4>Feedback<\/h4>\n<p>Your feedback is welcome! I may not always respond promptly; and I confess that some bugs were left open for more than I would have liked them to. I hope to make for good quality of code, and bug reporting is one major factor you can control.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m pleased to announce a new release of the openark kit. There&#8217;s a lot of new functionality inside; following is a brief overview. The openark kit is a set of utilities for MySQL. They solve everyday maintenance tasks, which may be complicated or time consuming to work by hand. It&#8217;s been a while since the [&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":[53,5],"tags":[25,57,34,31,8,50],"class_list":["post-3124","post","type-post","status-publish","format-standard","hentry","category-development","category-mysql","tag-analysis","tag-open-source","tag-openark-kit","tag-python","tag-replication","tag-scripts"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bZZp-Oo","_links":{"self":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3124","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=3124"}],"version-history":[{"count":21,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3124\/revisions"}],"predecessor-version":[{"id":3160,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/3124\/revisions\/3160"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/media?parent=3124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/categories?post=3124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/tags?post=3124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}