Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Time Machine


Published on

  • Login to see the comments

  • Be the first to like this

Time Machine

  1. 1. Time Machine Intro Lixun
  2. 2. What’s Time Machine • Rolling back instances/databases/tables to a snapshot • Implement on Server-Level, so support all engines. • By full image format binary logs • Currently, it’s a feature inside mysqlbinlog tool (with--flashback option)
  3. 3. Why Time Machine • Anyone maybe make mistakes, include DBA. • After users mis-operate their data, of course, we can recovery it from the last full backup set and binary logs. • But if users’ database is too huge, it will cost so much time! And usually, mis-operation just modify a few data, but we need to recovery whole database.
  4. 4. How Time Machine Works • As we know, if binlog_format is ROW (binlog-row-image=FULL in 5.6 and later), all columns’ values are store in the row event, so we can get the data before mis-operation. • Just do following things: • Change Event Type, INSERT->DELETE, DELETE->INSERT • For Update_Event, swapping the SET part and WHERE part • Applying those events from the last one to the first one which mis-operation happened. • All the data will be recovered by inverse operations of mis-oprerations.
  5. 5. Done List • Full DML supports • Review table supports • Because users may be want to check which parts of data be flashbacked. • 10.0 supports • It doesn’t support GTID now. So it doesn’t support 10.1 and later
  6. 6. ToDo List • Adding GTID supports • Deleting GTIDs which be flashbacked ? Unfriendly for replication. • Adding new GTIDs for new events executed by time machine ? • Adding DDL supports • For ADD INDEX/COLUMN, or CREATE TABLE query, just drop the index, column, table when running Flashback. • For DROP INDEX/COLUMN, or DROP TABLE query, will copy or rename the old table to a reserved database. When Flashback is running, I can drop new table, and rename the saved old table to original database. • For TRUNCATE table, I just rename old table to reserved database and create a new empty table. • Adding a new command for time machine or a script?
  7. 7. Flashback command