Giter VIP home page Giter VIP logo

pt-online-schema-change-plugins's Introduction

Yelp pt-online-schema-change-plugins

Introduction

These are some sample pt-online-schema-change plugins based off of the ones we use at Yelp when running pt-online-schema-change. Also included is a sample pt-online-schema-change.cnf, which you can deploy in /etc/percona-toolkit alongside the plugin.

To learn more about how Yelp uses pt-online-schema-change, you can check out my talk at Percona Live 2016, a link to the slides is at the bottom of the page.

The Plugins

init

An example of using the local database connection to obtain the database name, and using it in a command to announce the start of the pt-online-schema-change run in the dba IRC channel.

before_exit

Like init, this plugin announces the finish of a pt-online-schema-change run.

get_slave_lag

This plugin is more complicated because it returns a subroutine. You can do your setup before defining $lag. This sample plugin currently always returns a lag of 3.

before_create_new_table

Because pt-online-schema-change requires a user with the SUPER privilege, it's worth it to verify that it's running against a master withi read_only=0, and not, a replica with read_only=1.

before_swap_tables

We run pt-online-schema-change with --no-drop-old-table so that we can revert the change in case of an emergency. Having the master binary log coordinates is useful to examine changes from just before the point of swapping the new table in place.

Using

To use just a plugin file like this one, add:

--plugin /your/path/here/pt-online-schema-change-plugin.pl

to your pt-online-schema-change command.

Or, use an pt-online-schema-change.cnf like the one provided, which includes a reference to the plugin file. We use the default location of /etc/percona-toolkit for both.

pt-online-schema-change-plugins's People

Contributors

jcsnyder avatar

Stargazers

Whats in the name avatar shizhongtang avatar satish viswanatham avatar RZ avatar dikang123 avatar Pau Pérez Fabregat avatar Marcin Wasiluk avatar Balazs Pocze avatar Silvia Botros avatar Evan Elias avatar Rick Wong avatar

Watchers

Tomas Doran avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.